Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic:present not working??????

 
hw khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Iam trying basic struts examples , my JSP is not getting inside the logic resent block
Iam taking in user name , searching if it exits in a list , is yes then displays the result on the same jsp page else error message on the same jsp page.

How to forward action to the same JSP page in struts-config.xml file ?
is there anything missing in the following JSP?

<html:form action="/search">
<table>
<tr>
<td align="right"><bean:message key="label.search.name"/>:</td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td></td>
<td>-- or --</td>
</tr>
<tr>
<td align="right"><bean:message key="label.search.ssNum"/>:</td>
<td><html:text property="ssNum"/> (xxx-xx-xxxx)</td>
</tr>
<tr>
<td></td>
<td><html:submit/></td>
</tr>
</table>
</html:form>

<logic resent name="SearchForm" property="results">

<hr width="100%" size="1" noshade="true">

<bean:size id="size" name="searchForm" property="size"/>
<logic:equal name="size" value="0">
<center><font color="red"><b>No Employees Found</b></font></center>
</logic:equal>

<logic:greaterThan name="results" value="0">
<table border="1">
<tr>
<th>Name</th>
<th>Social Security Number</th>
</tr>
<logic:iterate id="result" name="searchForm" property="results">
<tr>
<td><bean:write name="result" property="name"/></td>
<td><bean:write name="result" property="ssNum"/></td>
</tr>
</logic:iterate>
</table>
</logic:greaterThan>

</logic resent>

</body>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your JSP code looks OK. Show is the relevant code in your Action class.

Hint: To make your code easier to read in your post, cut ant paste it into the edit panel, select it and click the "CODE" button.
 
hw khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Merrill

Here is the action code


Note from Merrill: Added [ C O D E ] at the beginning of the block and [ / C O D E ] at the end of the block to make the code more readable.
[ October 23, 2007: Message edited by: Merrill Higginson ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After taking a second look at your JSP, I did see one problem. Change

to
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic