This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 result in New Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 result in New Window" Watch "Struts 2 result in New Window" New topic
Author

Struts 2 result in New Window

Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
Hi

I want to open a JSP in a new window based on the result from action class.

on submitting a form, some processing is done in action class and dao and based on the result a new window should open if result is positive(true) else it displays a error message in the same form page.

Is there any way in struts.xml by which I can open a new window based on a particular result ?
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

struts.xml ummm... I doubt... you can do it from action class or any other servlet...

well, what do you want exactly... a new window altogether or a pop-up and if you want a new window do you want a child window ? and do you want to disable the parent first ?

anyways.. the conditions can be handled using <s:if> tag.



Time is what we want the most, but what we use the worst. -- William Penn
Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
I want to open a child window if a method in action class returns a string "true".
if it returns "false" then it should not open a new window and it should print the error on the parent window.
Nothing should happen to the parent window(only child window should open) after clicking the submit button if the return string is "true".

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

you can get the concept at this Link

Just replace the button logic with your <s:if> and <s:else> tags...

I dont know if you have any struts 2 tags for doing this.. libraries / javascript seems to be the solution..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2 result in New Window