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 Generating actions for submit buttons based on button 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 "Generating actions for submit buttons based on button" Watch "Generating actions for submit buttons based on button" New topic
Author

Generating actions for submit buttons based on button

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
We have a Struts JSP where there are multiple submit buttons on it. We want to have a new browser window (tab) open for one of the submit buttons on this form, but not for the other submit buttons (the other buttons should display response in the same window).

I've written a JavaScript function that does this using onClick events for the buttons to call functions that individually set the target variable of the document object. Works great.

I also found another way by using JavaScript's window.open.

So, my question is what's the best way to modify this JSP so I do this within the Struts environment?

I tried to add this information in to the forward definition (target="_blank") in Struts-config.xml, but that didn't work.

Perhaps the JavaScript solution works fine in Struts?

I look forward to any and all replies!!!

Thanks.

M
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Mike,
What is wrong with using the JavaScript approach?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The JavaScript approach will work just fine in a Struts application. If it works, why change it?


Merrill
Consultant, Sima Solutions
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
OK, thanks.

I just got some feedback from our architect that I needed to do this the "Struts way". I wasn't sure what he meant either so I thought I'd post a message a "sanity check".

Thanks to all for your replies....MUCH APPRECIATED!!!



M
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Generating actions for submit buttons based on button
 
Similar Threads
link another jsp page when button clicked- how- help urgent
Getting new browser window to open
How to make a request from jsp or action class to the new jsp to open in new browser
Getting new browser window to open
POPUP