aspose file tools*
The moose likes Struts and the fly likes using c:out in a href and html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using c:out in a href and html:select" Watch "using c:out in a href and html:select" New topic
Author

using c:out in a href and html:select

srilakshmi sadhu
Greenhorn

Joined: May 08, 2008
Posts: 2
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Rama Krishna
Ranch Hand

Joined: Oct 16, 2007
Posts: 110
For someone still interested to use the struts html:select tag, you should be using the
Rama Krishna
Ranch Hand

Joined: Oct 16, 2007
Posts: 110
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
 
subject: using c:out in a href and html:select