Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Generating actions for submit buttons based on button

 
Bartender
Posts: 1757
17
  • 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
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
What is wrong with using the JavaScript approach?
 
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
Bartender
Posts: 1757
17
  • 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
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic