• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Nesting a Struts Tag within html:select  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I have code like this :
<html:select name="rowData" property="srlNum" onchange="popVal(<bean:write name="rowData" property="srlNum"/> ">
Let me know if anyone has tried this.
Thanks,
Sam.
 
author & internet detective
Sheriff
Posts: 38569
659
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,
I wasn't able to do that when I tried.
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't nest tags like that. Something like the following should work though:

HTH
[ April 22, 2004: Message edited by: Jason Menard ]
 
Sam Chako
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jason,
I did figure a way out of the mess -
First the problem:
<html:form ... action="MyAction.do"...... >
<logic:iterate ........... id="rowData" >
<bean efine id="something" name="..." property="someVal"/>
<html:select name="rowData" property="srlNum">
<html ptions collection="something" labelProperty="..." property="desc" />
</html ptions>
</html:select>
</logic:iterate>
</html:form>
I had to get individual values of the SELECTs for each row. Problem was they all had the same name. I thought that if I could fire some JavaScript for the onChange() event of SELECT ...I would need the row number and hence nested tags.
Alternative Solution
--------------------
In MyAction class:
String[] vals = request.getParameterValues("srlNum");
int i = vals.length;
for(int j=0; j< i; j++){
logger.info("Value " + (j+1) + "= " + vals[j]);
}
Thanks a lot guys.
Sam
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!