Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating actions for submit buttons based on button

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34375
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
What is wrong with using the JavaScript approach?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaScript approach will work just fine in a Struts application. If it works, why change it?
 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic