丄諦啲仇魜ヤ
如 果 敌 人 让 你 生 气 , 那 说 明 你 没 有 胜 他 的 把 握!
posts - 6,comments - 56,trackbacks - 1

<tr>  
   <th> ID  </th>
    <th> 姓名</th>
    <th>密码</th>
    <th>  删除? </th>
</tr>
<%
    List userList=(List)request.getAttribute("userList");
    for(int i=0;i<userList.size();i++)
    {
      TUser tUser=(TUser)userList.get(i);
   %>
   <tr>
   <td ><%=tUser.getUsername() %></td>
  
   <td><%=tUser.getPassword() %></td>
    <td>
   <html:link action="/deleteUser.do?userId=${User.id}">&nbsp;&nbsp;删除</html:link>
 </td>
   </tr>
   <%
  
     }
    %>
/*********************************************************************************/

<tr>
       <th>
     ID
    </th>
    <th>
     姓名
    </th>
    <th>
     密码
    </th>
    <th>
     删除?
    </th>
    
               </tr>

   <logic:present name="userList" scope="request">
    <logic:iterate id="User" name="userList" indexId="index">
     <tr>
      <td>
       ${User.id}
      </td>
      <td>
       <bean:write name="User" property="username" />
      </td>
      <td>
       <bean:write name="User" property="password" />
      </td>
      <td>
       <html:link action="/deleteUser.do?userId=${User.id}">&nbsp;&nbsp;删除</html:link>
      </td>

     </tr>
    </logic:iterate>

   </logic:present>

///////////////***********************************//////////////////////////
<body>
  <%
       HashMap<String,String> mapYear=new HashMap<String,String>();
       mapYear.put("0","1980");
       mapYear.put("1","1981");
       mapYear.put("2","1982");
       mapYear.put("3","1983");
       request.setAttribute("mapYear",mapYear);
        HashMap<String,String> mapMonth=new HashMap<String,String>();
       mapMonth.put("0","01");
       mapMonth.put("1","02");
       mapMonth.put("2","03");
       mapMonth.put("3","04");
       request.setAttribute("mapMonth",mapMonth);
        HashMap<String,String> mapDay=new HashMap<String,String>();
       mapDay.put("0","1");
       mapDay.put("1","2");
       mapDay.put("2","3");
       mapDay.put("3","4");
       request.setAttribute("mapDay",mapDay);
  %>

  <html:form action="/addStudent" focus="username">
  
     username : <html:text property="username" />
   <html:errors property="username" />
   <br />
     password : <html:password property="password" />
   <html:errors property="password" />
   <br />
   
   sex : <html:radio property="sex" value="m" />男
          <html:radio property="sex" value="f" />女<br />
   
   birthday :<html:select property="birthdayYear" size="1">
    <logic:iterate id="map1" name="mapYear" indexId="id">
     <html:option value="${map1.value}">${map1.value}</html:option>
    </logic:iterate>
   </html:select>年
                <html:select property="birthdayMonth" size="1">
    <logic:iterate id="map2" name="mapMonth" indexId="id">
     <html:option value="${map2.value}">${map2.value}</html:option>
    </logic:iterate>
   </html:select>月
            <html:select property="birthdayDay" size="1">
    <logic:iterate id="map3" name="mapDay" indexId="id">
     <html:option value="${map3.value}">${map3.value}</html:option>
    </logic:iterate>
   </html:select>日<br />
           
   
   grade : <html:text property="grade" />
   
   <br />
   <html:submit />
   <html:cancel />
  </html:form>
 </body>
/*********************struts中隔行颜色不同的显示*************************************/


<logic:iterate id="Produt" name="list" indexId="id">
    <bean:define id="result" value="${Produt.id%2}"></bean:define>
    <logic:equal value="0" name="result">
   <tr bgcolor="green">

    <td>
     ${Produt.typeId}
    </td>
    <td>
     ${Produt.name}
    </td>
    <td>
     ${Produt.price}
    </td>
    <td>
     ${Produt.meno}
    </td>
                
   </tr>
   </logic:equal>
    <logic:equal value="1" name="result">
   <tr bgcolor="yellow">

    <td>
     ${Produt.typeId}
    </td>
    <td>
     ${Produt.name}
    </td>
    <td>
     ${Produt.price}
    </td>
    <td>
     ${Produt.meno}
    </td>
                
   </tr>
   </logic:equal>
  </logic:iterate>

posted on 2007-10-18 19:10 Crying 阅读(1555) 评论(0)  编辑  收藏 所属分类: Jsp+Struts

只有注册用户登录后才能发表评论。


网站导航: