A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Populating actionform elements outside html:form etc
Joined: Sep 02, 2005
Sep 02, 2005 07:26:00
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 ?
Joined: Feb 05, 2003
Sep 02, 2005 08:29:00
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
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.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Populating actionform elements outside html:form etc
nested logic:iterate tags possible?
Accessing an element in a List
How to obtain the id of a clicked button
passing formBeans to tiles...
Can't conditionally exclude parts of Struts page
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015