Within my javascripts, when I want to post to a different action, I use
this struts tidbit:

<script>
  var newAction = '<html:rewrite page="/ActionIWantToCall.do" />';
  document.form[x].submit();

Make sure your form is good, meaning, start form and end form.
I use all different browsers/os systems, and never have trouble doing
what you want. Double check the html and make sure it is valid.

Also, if you want to add args, use this type of rig in your pages
/* hack for the html:link to go back a level */
java.util.HashMap params = new java.util.HashMap();
params.put("loadNum", dataForm.getLoadNum());
pageContext.setAttribute("upLink", params);

If you look at the rewrite, link and other tags it want a map. So simply
add this in your jsp page, add params, then call it like so:
          <html:link action="exceptionMain" name="upLink">


Here is one of mine straight from a jsp page
var url = "<html:rewrite page="/DataExceptionFrameset.do" />";
            var width=600;
            var height=400;
            var left = parseInt((screen.availWidth/2) - (width/2));
            var top = parseInt((screen.availHeight/2) - (height/2));
            var windowFeatures = "width=" + width + ",height=" + height
+
 
",status=1,resizable=1,scrollbar=1,toolbar=0,menubar=0,left=" + left +
",top=" + top +
            ",screenX=" + left + ",screenY=" + top;
            var myWindow = window.open(url, "DataException",
windowFeatures);
            myWindow.focus();


If you still have trouble email me OL.

scott


-----Original Message-----
From: Gary Feidt [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 21, 2006 7:44 AM
To: user@struts.apache.org
Subject: Re: why my page can't redirect under Struts with Javascript?

I'm sorry, but this is a Javascript issue.  If you want to use Struts,
use Struts.  Create an ActionForm to get your value from the drop-down
list and then redirect to any number of Actions from your Action.  I
believe that is the easiest way, and a LOT less time consuming then
sending all of these emails.

Gary

>>> [EMAIL PROTECTED] 2/20/2006 9:53:33 PM >>>
I try follows:
function goURL(tmp){
  document.forms[0].submit();
 }

I debug the Javascript,when running the statement
document.forms[0].submit();

Javascript raise a error:
Microsoft JScript running error:object can't support this attribute or
method

Why?


On 2/21/06, Dave Newton <[EMAIL PROTECTED]> wrote:
>
> red phoenix wrote:
> > I tried follows:
> > function goURL(tmp){
> >   document.forms[0].action=eval("/Log/log.do?action=First");
> >   document.forms[0].submit();
> >  }
> >
> > and
> > function goURL(tmp){
> >   document.forms[0].action=eval("/log.do?action=First");
> >   document.forms[0].submit();
> >  }
> >
> > My page also can't redirect!
> >
> Why are you eval-ing a string? Since "/log.do?action=First" is not a
> valid JavaScript statement, this will fail.
>
> Pay attention to JavaScript errors.
>
> Dave
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
>
>
__________________________________

Confidentiality Statement:
This email/fax, including attachments, may include confidential and/or
proprietary information and may be used only by the person or entity to
which it is addressed. If the reader of this email/fax is not the
intended recipient or his or her agent, the reader is hereby notified
that any dissemination, distribution or copying of this email/fax is
prohibited. If you have received this email/fax in error, please notify
the sender by replying to this message and deleting this email or
destroying this facsimile immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to