You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Egan <ju...@dnai.com> on 2001/09/06 05:52:21 UTC
html:link + javascript
Hello all,
I have a non-struts JSP that uses javascript to submit a form from a
link in the form:
<td>
<a href='javascript:submitForm("IE","outerBorderColor")'>Outer
Border</a>
</td>
This works exactly as I expect.
I have been unable to get this to work in struts:
<td>
<html:link href='javascript:submitForm("IE","outerBorderColor")'>
<bean:message key="input.outerBorderColor"/>
</html:link>
</td>
The error is:
java.lang.IllegalArgumentException:
javascript:submitForm("IE","outerBorderColor")
I have fooled around with the quotes in various ways
<html:link href="javascript:submitForm('IE','outerBorderColor')">
Same result.
I have read many,many e-mails in the newsgroups pertaining to javascript
and struts and html:link:
I found and tried 1 suggestion that didn't work:
<html:link href=""
onclick='javascript:submitForm("IE","outerBorderColor")'>
Will someone please tell me how to accomplish this in struts?
Thank you
Robert Egan
Re: html:link + javascript. No solution
Posted by Robert Egan <ju...@dnai.com>.
Hello Jishan,
Thank-you for response;but manually escaping the code does not help.
I looked into the jsp created servlet for the non struts program.
<a href='javascript=submitForm("IE"<"outerBorderColor")'>Outer
Border</a>
This generates <a
href="javascript=submitForm(\"IE\",\"outerBorderColor\")'>Outer
Border</a>
I put this code in the struts app and get the same
"IllegalArgumentException"
I have no idea what this exception means. Possibly struts adding the
sessionId to the URL causes problems.
Does anyone have any other solutions???
Thanks
Robert Egan
Jishan Li wrote:
> I trid the following: <%@ taglib uri="/WEB-INF/struts-html.tld"
> prefix="html" %> <td>
> <html:link href='javascript:submitForm("IE","outerBorderColor")'>
> abc
> </html:link>
> </td> it genereates: <td>
> <a
> href="javascript:submitForm("IE","outerBorderColor")">abc</a>
>
> </td>The url has been encoded.
> 'javascript:submitForm(%22IE%22,%22outerBorderColor%22)' may help, I
> think. Jishan Li
>
> ----- Original Message -----
> From:Robert Egan
> To: struts-user@jakarta.apache.org
> Sent: Thursday, September 06, 2001 11:52 AM
> Subject: html:link + javascript
> Hello all,
>
> I have a non-struts JSP that uses javascript to submit a
> form from a link in the form:
>
> <td>
> <a
> href='javascript:submitForm("IE","outerBorderColor")'>Outer
> Border</a>
> </td>
>
> This works exactly as I expect.
>
> I have been unable to get this to work in struts:
>
> <td>
> <html:link
> href='javascript:submitForm("IE","outerBorderColor")'>
> <bean:message key="input.outerBorderColor"/>
> </html:link>
> </td>
>
> The error is:
> java.lang.IllegalArgumentException:
> javascript:submitForm("IE","outerBorderColor")
>
> I have fooled around with the quotes in various ways
> <html:link
> href="javascript:submitForm('IE','outerBorderColor')">
> Same result.
>
> I have read many,many e-mails in the newsgroups pertaining
> to javascript and struts and html:link:
> I found and tried 1 suggestion that didn't work:
> <html:link href=""
> onclick='javascript:submitForm("IE","outerBorderColor")'>
>
> Will someone please tell me how to accomplish this in
> struts?
>
> Thank you
> Robert Egan
>
Re: html:link + javascript
Posted by Jishan Li <jl...@easisoftintl.com>.
I trid the following:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<td>
<html:link href='javascript:submitForm("IE","outerBorderColor")'>
abc
</html:link>
</td>
it genereates:
<td>
<a href="javascript:submitForm("IE","outerBorderColor")">abc</a>
</td>
The url has been encoded.
'javascript:submitForm(%22IE%22,%22outerBorderColor%22)' may help, I think.
Jishan Li
----- Original Message -----
From: Robert Egan
To: struts-user@jakarta.apache.org
Sent: Thursday, September 06, 2001 11:52 AM
Subject: html:link + javascript
Hello all,
I have a non-struts JSP that uses javascript to submit a form from a link in the form:
<td>
<a href='javascript:submitForm("IE","outerBorderColor")'>Outer Border</a>
</td>
This works exactly as I expect.
I have been unable to get this to work in struts:
<td>
<html:link href='javascript:submitForm("IE","outerBorderColor")'>
<bean:message key="input.outerBorderColor"/>
</html:link>
</td>
The error is:
java.lang.IllegalArgumentException: javascript:submitForm("IE","outerBorderColor")
I have fooled around with the quotes in various ways
<html:link href="javascript:submitForm('IE','outerBorderColor')">
Same result.
I have read many,many e-mails in the newsgroups pertaining to javascript and struts and html:link:
I found and tried 1 suggestion that didn't work:
<html:link href="" onclick='javascript:submitForm("IE","outerBorderColor")'>
Will someone please tell me how to accomplish this in struts?
Thank you
Robert Egan