aspose file tools*
The moose likes Struts and the fly likes JSTL conversion for struts 1.1 code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSTL conversion for struts 1.1 code" Watch "JSTL conversion for struts 1.1 code" New topic
Author

JSTL conversion for struts 1.1 code

Akash Sinha
Greenhorn

Joined: Dec 11, 2006
Posts: 1
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL conversion for struts 1.1 code
 
Similar Threads
Retrieving values of a select from inside nested logic:iterate
Trying to show a pulldown using Struts html:select
bean value persists on clicking back
BeanUtils.populate IndexOutofBound
c:when test = .....problem