You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McSweeney <br...@aurium.net> on 2003/07/03 14:20:43 UTC

How to pass parameters to a javascript popup

Hi all,
 
In my jsp I want to create a standard <link>help with this field</link>
which
will use javascipt to create a little popup dialog.
 
I want my site to be internationalized, so the contents of the dialog
box is also 
a jsp which is going to read from my resource bundle to get the help
message.
 
I was thinking of trying to pass a string into the popup dialog jsp, so
that I would 
only ever have to write a single popup.jsp and it would be able to get
the error 
message based on the string.
 
For example
 
Main.jsp
 
<link messageValue="message1"> help with this function<link/>
 
 
<link messageValue="message2"> help with this function<link/>
 
 
then in the popup.jsp
 
<bean:message key="messageValue"/>
 
However, I'm not sure 
 
a) if this makes any sense
b) how to pass the parameter (should I go through an action?)
 
 
hope this makes some sense,
 
thanks for any responses,
Brian
 

Re: How to pass parameters to a javascript popup

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Brian McSweeney wrote:
> <html:link href="" paramId="helpMessage" staticvalue="helpMessage1"
> 	
> onClick="openWindow('poppedup.jsp','popup','scrollbars=yes,width=1000,
> height=500,left=10,top=100')">
> </html:link>
> 

Try

<a href="help" 
onclick="openWindow('poppedup.jsp?helpMsg=helpMsg1');return false;">Help</a>

The return false will stop the link doing any redirecting of the current 
window, and the popup will obtain the URL + querystring as defined in 
the javascript.

Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: How to pass parameters to a javascript popup

Posted by Brian McSweeney <br...@aurium.net>.
Hi Adam,
Thanks for the help. The problem I have is, if I'm using the html:link
tag 
to pass the parameters, how do I pass the static value?

For example, if I wanted to have two links on the one page, I was
thinking of doing something like the following:

<html:link href="" paramId="helpMessage" staticvalue="helpMessage1"
	
onClick="openWindow('poppedup.jsp','popup','scrollbars=yes,width=1000,
height=500,left=10,top=100')">
</html:link>

<html:link href="" paramId="helpMessage" staticvalue="helpMessage2"
	
onClick="openWindow('poppedup.jsp','popup','scrollbars=yes,width=1000,
height=500,left=10,top=100')">
</html:link>

A) will this parameter get appended to the 'poppedup.jsp@

B) there is no "staticvalue" attribute on the link tag. So 
how do I define a string value to get passed. The docs say 
you need to pass it a page scoped bean and it looks up the 
value from the bean!!

This always confuses me,
Thanks for your help,
Brian




-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
Sent: 03 July 2003 13:42
To: Struts Users Mailing List
Subject: Re: How to pass parameters to a javascript popup

Brian McSweeney wrote:
> a) if this makes any sense

yes it does

> b) how to pass the parameter (should I go through an action?)

I don't see any reason to go thro an action, but you could go thro an 
action forward mapping for the sake of the URL appearance and security. 
A querystring parameter would be fine. What do you think the problem 
might be?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How to pass parameters to a javascript popup

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Brian McSweeney wrote:
> a) if this makes any sense

yes it does

> b) how to pass the parameter (should I go through an action?)

I don't see any reason to go thro an action, but you could go thro an 
action forward mapping for the sake of the URL appearance and security. 
A querystring parameter would be fine. What do you think the problem 
might be?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org