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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:text within Logic:iterate" Watch "html:text within Logic:iterate" New topic

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

<%@ taglib uri="" prefix="html" %>
<%@ taglib uri="" prefix="bean" %>
<%@ taglib uri="" prefix="logic" %>


<title>Test Application</title>

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

<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:greaterThan name="size" value="0">
<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>

<logic:iterate id="test" name="inputForm" property="results" >
<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>

</logic resent>


Is it supposed to be like?

<html:form action="\a">
Do something
<html:form action="\b">
Thanks in advance..

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.
Merrill Higginson
Ranch Hand

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

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..
Achalveer Singh

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

I agree. Here's the link:
subject: html:text within Logic:iterate
It's not a secret anymore!