• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New window using struts action

 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have the following return statement in an action:

return mapping.findForward("target");

"target" is mapped to a jsp page in struts-config.
How can the jsp be displayed in a new window using struts? Thanks in advance.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think the server can force a new window.

I believe you'll have to declare target='_blank' from the browser.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Mark said,

<html:link page="/myAction.do" target="_blank">

will open the action called by the link in a new window.
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,

I have a question on the similar lines. I've also encountered similar situation. I used a simple JavaScript function to fire off an action in a new window. Since, the menu, toolbar etc. was not supposed to be shown, I had to use this solution(though it's only to fool lay people ).

How far do you think, this solution can be accepted? Though this works for me for the time being, I'm sure 1) there are better ways to do it 2) This approach does not seem to have it's proper roots.

Please share your thoughts on this.

Thanks and regards,
Kinjal Sonpal
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kinjal Sonpal:

How far do you think, this solution can be accepted? Though this works for me for the time being, I'm sure 1) there are better ways to do it 2) This approach does not seem to have it's proper roots.


Why do you say it doesn't have "proper roots"? Sure, it may seem ugly but that's the best that you can do, really. As mentioned/alluded to above, "windowing" is a client-side function. The server process really doesn't have anything to do with it.
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Junilu, for clearing my doubt.

Regards,
Kinjal Sonpal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic