• Post Reply Bookmark Topic Watch Topic
  • New Topic

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
Marshal
Posts: 38391
649
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!