Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using c:out in a href and html:select

 
srilakshmi sadhu
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am trying to use html:select element and a:href element along with jsp <c: tags in a jsp.
While using <a href element along with cut, the following piece of code compiles and runs fine:
<a href="javascript:deleteChannelRow('<cut value="${rowNum}" />');">test </a>

But while using <html:select element along with cut, the following piece of code doesnot compile:
<html:select property="tt" name="dat" onchange="javascript:populateprofiles('<cut value="${rowNum}" />');" >
<htmlption value="" >select profile</htmlption>
</html:select>
The javascript error is occured in the double quote of the javascript function and jsp syntax is missed in middle.



If anyone has worked on this, let me know if this is a problem with html:select or if there is a work around for this problem.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference between success with the <a> tag and failure with the <html:select> tag is that the <a> tag is a plain HTML tag, while the <html:select> tag is a custom tag. Since the <cut> tag is also a custom tag, it won't work to embed it inside the property of another custom tag, while it works fine in the property of a plain HTML tag.

If your application is Servlet 2.4 compliant (You can tell by the DTD reference in your web.xml file) then you can simply use the EL Expression ${rowNum} rather than the cut tag. Otherwise, your options are to use a scriptlet, or to use the struts-el version of the html tags, which allow you to use an EL expression in a Struts tag even in a servlet 2.3 application.
 
Rama Krishna
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For someone still interested to use the struts html:select tag, you should be using the
 
Rama Krishna
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For someone still interested to use the struts <html:select> tag, you could make use of indexId attribute of <logic:iterate ..> tag


That works for me.

Cheers
Rama
[ December 31, 2008: Message edited by: Rama Krishna ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic