You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pankaj Gupta <Pa...@hsc.com> on 2006/11/08 06:06:08 UTC

How to pass Java parameter to javascript

Hi All,

I am unable to pass a java parameter to a javascript method. Can you 
please tell whats going wrong. Here is my code:
<html:submit property="submitType" onclick="setFile('<%= 
((FileInstance)nmeFile).getFileName() %>', this.form);" >

regards,
Pankaj

Re: How to pass Java parameter to javascript

Posted by Puneet Lakhina <pu...@gmail.com>.
On 11/8/06, Pankaj Gupta <Pa...@hsc.com> wrote:
>
> Hi All,
>
> I am unable to pass a java parameter to a javascript method. Can you
> please tell whats going wrong. Here is my code:
> <html:submit property="submitType" onclick="setFile('<%=
> ((FileInstance)nmeFile).getFileName() %>', this.form);" >


You got to do something like this
<html:submit property="submitType" onclick='<%="setFile(' +
((FileInstance)nmeFile).getFileName() + ",this.form);" %>'
>Submit</html:submit>


regards,
> Pankaj
>



-- 
Puneet

Re: How to pass Java parameter to javascript

Posted by WongTseng <wa...@gmail.com>.
when you insert jsp scriptlet into  the  tag  as a value of an attribute,
the scriptlet should be bracketed by the quotation marks without anything
else inside.

2006/11/8, Pankaj Gupta <Pa...@hsc.com>:
>
> Hi All,
>
> I am unable to pass a java parameter to a javascript method. Can you
> please tell whats going wrong. Here is my code:
> <html:submit property="submitType" onclick="setFile('<%=
> ((FileInstance)nmeFile).getFileName() %>', this.form);" >
>
> regards,
> Pankaj
>



-- 
Wong Tseng
王曾

Re: How to pass Java parameter to javascript

Posted by Martin Gainty <mg...@hotmail.com>.
set the value in hidden field/pass to JS function/set JD param to value of hidden field ..example located at
http://javaboutique.internet.com/tutorials/strutstand/index-2.html

Anyone else?
M-
This e-mail communication and any attachments may contain confidential and privileged information for the use of the 
designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its 
contents
----- Original Message ----- 
From: "Pankaj Gupta" <Pa...@hsc.com>
To: <us...@struts.apache.org>
Sent: Wednesday, November 08, 2006 12:06 AM
Subject: How to pass Java parameter to javascript


> Hi All,
> 
> I am unable to pass a java parameter to a javascript method. Can you 
> please tell whats going wrong. Here is my code:
> <html:submit property="submitType" onclick="setFile('<%= 
> ((FileInstance)nmeFile).getFileName() %>', this.form);" >
> 
> regards,
> Pankaj