Chetan Pandey wrote:
> Yes it is a JSP Page.

Ok, that's good at least :)

> I am printing <%=jsMessage%> also for debugging purposes and it prints
> correctly.

The only way for you to see a confirmation popup with the text
<%=jsMessage%> in it is if that expression isn't being evaluated,
because whatever the value of jsMessage, unless its undefined (which
should throw an exception), that expression should be replaced by the
value of jsMessage (could be an empty string, but still)...

...not being in a JSP was the easy answer, so now you'll have to look at
the more difficult possibilities....

...just to be anal about it, have a look at the returned source and make
sure your seeing the unevaluated expression in it.  Assuming you see it,
try some other JSP things and see if they work, maybe <%="test"%> for
instance, which should obviously result in just "test" in the source...
 If that doesn't evaluate either, make sure your JSP processor is
actually handling the JSP and not just returning it as-is.  If a
constant string *is* being evaluated, I admit I'm stumped :)

Frank

> 
> 
> -----Original Message-----
> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 07, 2006 11:47 AM
> To: Struts Users Mailing List
> Subject: Re: Setting a Variable in Javascript Functions parameter
> 
> Then your JSP expression is not being evaluated... this *is* in a JSP,
> right??
> 
> Frank
> 
> Chetan Pandey wrote:
>> Doing what you suggested results in a Confirm Box with Text =
> <%=jsMessage%>
>> Is something wrong with my JS function. 
>>
>> Here it is:
>>
>> <script type="text/javascript">
>> function confirmationMessage(message)
>> {
>> var agree = confirm(message);
>> if (agree)
>>      return true ;
>> else
>>      return false ;
>> }
>>
>> </script>
>>
>> -----Original Message-----
>> From: 皮苗 [mailto:[EMAIL PROTECTED] 
>> Sent: Friday, September 08, 2006 11:38 AM
>> To: Struts Users Mailing List
>> Subject: Re: Setting a Variable in Javascript Functions parameter
>>
>> Is jsMessage a java variable or a javascript variable? If it's a java
>> variable and you want to pass its value to the javascript function, I
> think
>> "onclick=return confirmationMessage('<%=jsMessage%>');" will work. The
>> quotes inside the parentheses shouldn't be omitted.
>>
>>
>> 2006/9/8, Chetan Pandey <[EMAIL PROTECTED]>:
>>> Hi Puneet:
>>>
>>> None of the suggestions worked.
>>>
>>> I even tried
>>> "onclick =returnconfirmationMessage(<%=jsMessage%>)"
>>>
>>> And other combinations with no help.
>>>
>>> Thanks.
>>>
>>> Chetan
>>>
>>> -----Original Message-----
>>> From: Puneet Lakhina [mailto:[EMAIL PROTECTED]
>>> Sent: Thursday, September 07, 2006 11:13 PM
>>> To: Struts Users Mailing List
>>> Subject: Re: Setting a Variable in Javascript Functions parameter
>>>
>>> On 9/7/06, nirav bumia <[EMAIL PROTECTED]> wrote:
>>>> Just pass the variable jsMessage(remove the quotes)  i.e.
>>>> <html:link action="/delete" onclick="return
>>>>> confirmationMessage(jsMessage)">
>>>> and use this variable in javascript.
>>> I suppose you are trying to pass a variable that you have in some scope
> in
>>> your jsp to your javascript function.
>>>
>>> Am not really sure the above suggested solution will work. Reason being
>>> there is no way for struts(or your jsp processor) to know if this is
>>> variable isnt actually a javascript variable.
>>>
>>> I would use something like this
>>>
>>> <html:link action="/delete" onclick =
>>> '<%="returnconfirmationMessage(jsMessage)" %>'
>>>
>>> Try it and let us know what happens.
>>> --
>>> Puneet
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to