wood burning stoves 2.0*
The moose likes Struts and the fly likes Populating actionform elements outside html:form etc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating actionform elements outside html:form etc" Watch "Populating actionform elements outside html:form etc" New topic
Author

Populating actionform elements outside html:form etc

darin sanana
Greenhorn

Joined: Sep 02, 2005
Posts: 2
Hello all,

let's say I have a action form called FoobarForm that populates <html:form> but I wan't to write some of the elements outside of the form.

E.g: some static values that cannot be changed (#ID, etc ... )

Is there some way to do this ? (<bean:write name="???" .. ), or is the only way to put the FoorbarForm also to the request scope (request.setAttribute(""))

Another question is about the <logic:iterate>-tag. Is there any way to limit the amount on iterations ? For example, If I want to iterate only the first five elements.

How about a situation where there is only one element to be iterated. Do I have to use <logic:iterate> then also or is there any alternative method to print the element ?

Thanks.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

You can use bean:write and specify the name of the form that you used in the struts-config.xml.
<bean:write name="myFormName" property="myValue"/>


You could also use JSTL
<c ut value='${myFormName.myValue}'/>

As far as your logic:iterate question... why would you use a collection when you know you have only one element? There's nothing to iterate over.


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating actionform elements outside html:form etc
 
Similar Threads
How to obtain the id of a clicked button
Can't conditionally exclude parts of Struts page
passing formBeans to tiles...
nested logic:iterate tags possible?
Accessing an element in a List