This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes nesting of tags in struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nesting of tags in struts?" Watch "nesting of tags in struts?" New topic
Author

nesting of tags in struts?

Adwait Patankar
Greenhorn

Joined: Jan 30, 2006
Posts: 6
Hi,

I need to call a javascript function in the href of my <html:link>. The javascript function needs to be passed a property in my form.
I'm trying with the following code :

<html:link href="javascript:test('<bean:write name="LoginForm" property="ename"/>')">

I'm getting the following exception:

[1/30/06 18:51:51:336 IST] 64d7befc WebGroup E SRVE0026E: [Servlet Error]-[/pages/details.jsp(32,66) Attribute LoginForm has no value]: org.apache.jasper.compiler.ParseException: /pages/details.jsp(32,66) Attribute LoginForm has no value.

Is it possible to include a struts tag inside another. The exception is because of mismatch of quotes. Can anybody suggest a solution for the same.

Thanks in advance.
Adwait
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
No, it is not possible to inclue one Struts tag inside another. You can include a scriptlet, however.

In this particular case, I'd recommend using the <a> tag. The html:link tag doesn't offer you any advantages in this case.

Just write:

<a href="javascript:test('<bean:write name="LoginForm" property="ename"/>')">


Merrill
Consultant, Sima Solutions
Adwait Patankar
Greenhorn

Joined: Jan 30, 2006
Posts: 6
Hi Merrill,
Thanks for the prompt reply. I had already tried using with <a> and it works fine. I just wanted to know whether we can use <html:link> struts tag for the same.
Regards,
Adwait
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nesting of tags in struts?
 
Similar Threads
using html:link to pass parameter
Validation failure
form submission using struts link tag
About html:link
Problem displaying link content in a perticular page using Struts