• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating actionform elements outside html:form etc

 
darin sanana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic