Struts : How to open a action in new window

Hi

When i submit my form  depends on action i have to open a new window,  How can i take care this in Action Class

LakshmanaRavulaAsked:
Who is Participating?
 
thirdConnect With a Mentor Commented:

<form action="somepage.cgi" targer="_new">
0
 
PaulioConnect With a Mentor Commented:
<script>
function make_target(form_ref){
  var target_win = window.open('', 'newwin', 'width=400,height=400');
  form_ref.target = target_win;
}
</script>
<form action="" onSubmit="make_target(this)">
  <input blabla>
</form>

hope it helps!
0
 
LakshmanaRavulaAuthor Commented:
Hi

I haqve tried using this option But Result coming into parent window and new window coming with no data
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LakshmanaRavulaAuthor Commented:

On Parent window i have 6 actions,  out of 6 one of the action should print report on new window so iam calling a javascript that contins new window for that Submit button  

New window coming with blank and report coming on parent window`
0
 
PaulioConnect With a Mentor Commented:
Oops...

The correct code to submit a form in a new (popup) window should have been:

<script>
function make_target(form_ref){
  window.open('', 'newwin', 'width=400,height=400');
  form_ref.target = 'newwin';
}
</script>
<form action="somepage.cgi" onSubmit="make_target(this)">
  <input type=text name=test value="" size=20>
  <input type=submit>
</form>

If you are actually looking for another solution, could you please post the relevant code?
0
 
thirdCommented:
err, "targer" should be "target"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.