• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

html:text within Logic:iterate

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, see this link on using indexed properties.
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merrill,
I just had a look and I am trying to solve out the issue..
Regards,
Roshani
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic