• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL conversion for struts 1.1 code

 
Akash Sinha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I 'am getting problems with the line which is bold when i convert to JSTL

struts logic code

logic:iterate id="eachParameterValue" name="ReportSearchForm" property="paramList" indexId="ind">
<bean:define id="eachParameterValueObj" name="eachParameterValue" scope="page" type="x.ParamLink"/>
<tr>
<td ></td>
<td class="label" ><label
for="Type"> <bean:write name="eachParameterValueObj" property="paramDisplayName"/>
</label></td>
<td></td>
<td class="data" >
<logic:equal name="eachParameterValueObj" property="paramDisplayType" value="text">
<html:text property='<%= "eachParamValue[" + ind + "].paramValue" %>'/>
</logic:equal>
<logic:equal name="eachParameterValueObj" property="paramDisplayType" value="dropdown">
<html:select property='<%= "eachParamValue[" + ind + "].paramValue" %>'>
<logic:iterate id="eachParameterDisplayTypeListRow" name="eachParameterValueObj" property="paramConstants">
<bean:define id="eachParameterDisplayTypeValueObj" name="eachParameterDisplayTypeListRow" scope="page" type="org.apache.struts.util.LabelValueBean"/>
<htmlption value="<%= eachParameterDisplayTypeValueObj.getValue() %>">
<bean:write name="eachParameterDisplayTypeValueObj" property="label"/>
</htmlption>
</logic:iterate>
</html:select>
</logic:equal>
</td>
<td></td>
</tr>
</logic:iterate>

JSTL code

<c:forEach items="${ReportSearchForm.paramList}" var="eachParameterValue">
<tr>
<td ></td>
<td class="label" ><label
for="Type"> <cut value="${eachParameterValue.paramDisplayName}"/>
</label></td>
<td></td>
<td class="data" >
<c:if test="${eachParameterValue.paramDisplayType == 'text'}">
<html:text property="${eachParameterValue.paramValue}"/>
</c:if>
<c:if test="${eachParameterValue.paramDisplayType == 'dropdown'}">
<html:select property="${eachParameterValue.paramValue}">
<c:forEach items="${eachParameterValue.paramConstants}" var="eachParameterConstObj">
<htmlption value="${eachParameterConstObj}">
<cut value="${eachParameterConstObj}"/>
</htmlption>
</c:forEach>
</html:select>
</c:if>
</td>
<td></td>
</tr>
</c:forEach>

Class ParamLink

private String paramDisplayName = null;
private String paramName = null;
private String paramType = null;
private String paramValue = null;
private String paramDisplayType = null;
private List <String> paramConstants = null;

followed by setters and getters

Is this code conversion accurate


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Please read ItDoesntWorkIsUseless.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic