aspose file tools*
The moose likes Struts and the fly likes Struts Action and javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Action and javascript" Watch "Struts Action and javascript" New topic
Author

Struts Action and javascript

Perindevi Peramur
Greenhorn

Joined: Dec 24, 2005
Posts: 10
Hi,
I have one submit button A and one ordinary button B. On clicking B, control is transfered to javascript as below. But it says file not found. But it works fine, if its not a pop up window and goes into regular jsp and displays info.

Thanks for any help

function popUp(field, mytest) {
var printList ="31~21";
var url = '/misc/comSelectionSave.do?printButton=Create Proof&printList='+printList;
var pop = window.open(url, 'Create Proof', 'height=550,width=800,scrollbars=yes,resizable=yes');
pop.focus();
document.forms[0].submit();
}

Why is the struts action not recognized here ?

If I use rewrite, then I am not able to pass the parameter printList.
var pop = window.open("<html:rewrite action="/misc/comSelectionSave?printButton=Create Proof"/>","Create Proof", "toolbar=0,scrollbars=0,status=1,resizable=0,menubar=0,width=400,height=500");
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem may be that you have a space in one of your parameters. You also have a space in the window name, which is not allowed.

Change:

var url = '/misc/comSelectionSave.do?printButton=Create Proof&printList='+printList;

to

var url = '/misc/comSelectionSave.do?printButton=Create+Proof&printList='+printList;

and

var pop = window.open(url, 'Create Proof', 'height=550,width=800,scrollbars=yes,resizable=yes');

to

var pop = window.open(url, 'Create_Proof', 'height=550,width=800,scrollbars=yes,resizable=yes');


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts Action and javascript