Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 39129
723
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
 
Oh. Hi guys! Look at this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!