0

我有ArraylistRequest scope其中包含所有Students对象..我正在显示该数据JSP page

class Student 
  {

   int sno;
   String name;
   String type; // here type can be either R or D
    .
    .
    .
  }

当我显示Student obj数据时我想检查student type if type=D然后我想添加<select>框怎么做???

我正在使用struts 1.3JDBC

我的代码是

 <logic:iterate id="student" name="allstudents" scope="request">

   <bean:write name="student"   property="sno" format="#"/><br>
   <bean:write name="student"   property="name" /><br>
   <bean:write name="student"   property="type" /><br>


   // here i want to display <select> if type =D
    .
    .
    .
 </logic:iterate>

请帮我

提前致谢

4

2 回答 2

1

帮自己一个忙,学习 JSTL。完成后,使用<c:forEach>、和 标签:<c:out><fmt:formatNumber><c:if>

<c:forEach var="student" items="${allstudents}">

    <fmt:formatNumber value="${student.sno}" pattern="#"/>
    <c:out value="${student.name}"/>
    <c:out value="${student.type}"/>
    <c:if test="${student.type == 'D'}>
        ...
    </c:if>

</c:forEach>
于 2013-02-12T07:59:38.430 回答
0
i tried like this this is working fine...
thank you JB Nizet....

 <logic:iterate id="student" name="allstudents" scope="request">

       <bean:write name="student"   property="sno" format="#"/><br>
       <bean:write name="student"   property="name" /><br>
       <bean:write name="student"   property="type" /><br>


       <c:if test="${student.type == 'D'}>
       ......
       </c:if>

     </logic:iterate>
于 2013-02-12T08:57:17.443 回答