aspose file tools*
The moose likes Struts and the fly likes logic:present not working?????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:present not working??????" Watch "logic:present not working??????" New topic
Author

logic:present not working??????

hw khan
Greenhorn

Joined: Oct 03, 2007
Posts: 9
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
hw khan
Greenhorn

Joined: Oct 03, 2007
Posts: 9
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

Joined: Feb 15, 2005
Posts: 4864
After taking a second look at your JSP, I did see one problem. Change

to
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic:present not working??????