• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

issue in getting the bean define id dynamically

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<bean efine id="<%=idValue%>" type="java.lang.String"/>

I need to get the id value dynamically to declare a bean.
It throws exception while parsing the JSP file.

Is there any other solution to it?

i have made the rtexprvalue to true for this attribute id in the struts-bean.tld
<name>define</name>
<tagclass>org.apache.struts.taglib.bean.DefineTag</tagclass>
<teiclass>org.apache.struts.taglib.bean.DefineTei</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

Kindly assist
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you trying to do? The id attribute specifies the name of the scripting variable to create. I am not sure that you want this to be dynamic. Here is a link to the documentation on that tag: http://struts.apache.org/1.1/userGuide/struts-bean.html#define

- Brent
 
purushottaman dwarkanathan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to generate unique ids in a logic iterate which will used for rendering links.

This bean efine is within a logic iterate, hence if i give a constant value, all the links which will use this id, will have the same value
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use indexId as a unique id. If you can't use the indexId, you should make the id a property of the collection that you iterate over. So if you are iterating over object a, create a.getId() and a.setId() and populate the id in your action. Then print the id while iterating.
reply
    Bookmark Topic Watch Topic
  • New Topic