• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
Posts: 38911
686
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!