jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nesting of tags in struts?" Watch "nesting of tags in struts?" New topic

nesting of tags in struts?

Adwait Patankar

Joined: Jan 30, 2006
Posts: 6

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.
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"/>')">

Consultant, Sima Solutions
Adwait Patankar

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: nesting of tags in struts?
It's not a secret anymore!