my dog learned polymorphism*
The moose likes Struts and the fly likes html:text within Logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:text within Logic:iterate" Watch "html:text within Logic:iterate" New topic
Author

html:text within Logic:iterate

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi all,
I wanted to know that if I can use the html:text within the Logic:iterate tag?

I have a result returned to the user. User has to be given an option to add a value in a text field in the form.
Do i have to create another form action for the single text??? If I use like the below, it gives an exception inspite of the getter setter in the form.
javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

code:
=---------
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>


<html:html>

<title>Test Application</title>

<body>
<html:form action="/CalendarAction" styleId="inputForm">
This is a test application.
<html:submit/>
</html:form>

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

<bean:size id="size" name="inputForm" property="results"/>

<logic:equal name="size" value="0">
<center><font color="red"><b>No Results Found</b></font></center>
</logic:equal>

<logic:greaterThan name="size" value="0">
<table>
<tr>
<td width="15%" >TERRITORY DESCRIPTION</td>
<td width="15%" class="yellowheading">REGION ID </td>
<td width="15%" class="yellowheading">TERRITORY ID</td>
<td width="15%" >Calendar</td>
</tr>


<logic:iterate id="test" name="inputForm" property="results" >
<tr>
<td><bean:write name="test" property="territoryDescription"/></td>
<td><bean:write name="test" property="regionid"/></td>
<td><bean:write name="test" property="territoryID"/></td>
<td><html:text property="datesubmittedfrom"/></td>
</tr>
</logic:iterate>
</table>
</logic:greaterThan>

</logic resent>

</body>
</html:html>
---------------------

Is it supposed to be like?

<html:html>
<html:form action="\a">
Do something
</html:form>
<logic:iterate>
</logic:iterate>
<html:form action="\b">
<html:text>
<html:submit>
</html:form>
----------------------
Thanks in advance..
Regards,
Roshani


Regards,<br />Roshani
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I don't know why you expect multiple forms to be generated. From the snippet
- form close tag is at wrong place. It should the last element
- If you expect just 1 text element then what's the need for iterate tag?
- If you want to generate more than 1 text element then the form should contain array for datesubmittedform property and you have make the text element as indexed (set indexed attribute of text element to true).

This link should help.
http://struts.apache.org/1.x/struts-taglib/tlddoc/html/text.html
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Also, see this link on using indexed properties.


Merrill
Consultant, Sima Solutions
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Thanks Merrill,
I just had a look and I am trying to solve out the issue..
Regards,
Roshani
Achalveer Singh
Greenhorn

Joined: Sep 22, 2006
Posts: 25
also see this link...
this is the tour of example in which they uses html with in iterate tag..
hope it will help you
http://struts.application-servers.com/struts-layout/tour.htm


ACHALVEER SINGH<br />SOFTWARE ENGINEER
 
Don't get me started about those stupid light bulbs.
 
subject: html:text within Logic:iterate
 
Similar Threads
JspTranslate: End of content reached while more parsing required: tag nesting error?.
Missing message for key
Error:No valid collection specified for size tag
doubt in Struts application
server encountered an internal error ;while running application