aspose file tools*
The moose likes Struts and the fly likes adding dynamic controls in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "adding dynamic controls in struts2" Watch "adding dynamic controls in struts2" New topic
Author

adding dynamic controls in struts2

rohit chavan
Ranch Hand

Joined: Oct 08, 2010
Posts: 131

Hi,

We are currently migrating one web application from struts 1.x to struts2.
In which, we have a functionality where we add a row of controls dynamically, in struts1.x what we did was
1. add a new "div"
2. create and concatenate html code using strut's <html:select/> tag
3. rewrite the innerHTML of that div with javascript

this can be done for multiple rows as well.

here is the code snippet for the same


this way it was working fine.

but when we are trying the same with <s:select /> in struts2like this,



we are getting 'Unterminated String constant' error in javascript!

we have already tried a number of combinations on this, to check if we are doing something wrong with the escape characters.

But as per my understanding, this is related to interpretation of the var by struts2.

awaiting replies on the same,

Thanks,
Rohit
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Look at the source html it might help you.. as struts 2 renders the s:select tag into multiple tags... label, table etc..

look here


Time is what we want the most, but what we use the worst. -- William Penn
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding dynamic controls in struts2
 
Similar Threads
Help me about html:select
Ajax, Struts, and a few pesky event based issues
how to apply continue statement in struts logic:iterate tag
JSTL conversion for struts 1.1 code
pass a variable in the URl