This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Opening a JSP from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Opening a JSP from javascript" Watch "Opening a JSP from javascript" New topic
Author

Opening a JSP from javascript

Krishna Attravanam
Greenhorn

Joined: Oct 21, 2004
Posts: 16
I am trying to do something like this

<a href=javascript:void(window.open('loadinfo.do?product_id=<dynamicValue>','load','location=0,status=0,scrollbars=0,width=480,height=400'))>Some Text </a>

I am trying to opening a JSP file using the javascript (& Struts) and the productID is dynamic...

I am not able to do it coz i am making a mistake with the syntax

Please help me with this Thanks

~K
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I am not able to help coz I don't know your mistake.

Show what you are trying instead of something like what you are trying and I or someone else can probably help.


A good workman is known by his tools.
Krishna Attravanam
Greenhorn

Joined: Oct 21, 2004
Posts: 16
Basically I am trying to open a jsp page in a pop up window using Javascript.

Now the page to be loaded is dependent upon the product id i pass..

Say if the product id is 2 a page named page2.jsp is loaded

so a different page is loaded based on the product id

how do i do it
Mike Farnham
Ranch Hand

Joined: Sep 25, 2001
Posts: 76
Krishna,

I would have a generic JSP as an intermediate step (dispatcher).

Your JavaScript can call it with the ProductID.
In the generic JSP, you can create the necessary URL and forward/re-direct to it.

Cheers,
Mike
Trevor Whitehead
Greenhorn

Joined: Oct 16, 2002
Posts: 16
Originally posted by Krishna Attravanam:
I am trying to do something like this

<a href=javascript:void(window.open('loadinfo.do?product_id=<dynamicValue>','load','location=0,status=0,scrollbars=0,width=480,height=400'))>Some Text </a>

I am trying to opening a JSP file using the javascript (& Struts) and the productID is dynamic...

I am not able to do it coz i am making a mistake with the syntax

Please help me with this Thanks

~K

Hi Krishna, it may be best to call a javascript function that accepts a couple of parameters to open the new window, calling the function with an onClick event from your form.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening a JSP from javascript
 
Similar Threads
Assigning JSP variables to an IF statement
Funny innerHTML behavior
Javascript is not working in new window.
Calling javascript function from jsp
form submitting on html link