This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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: 1073
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30595
    
154

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: 1073
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
 
Consider Paul's rocket mass heater.
 
subject: Generating actions for submit buttons based on button