struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saul Qunming Yuan" <y...@dataanvil.com>
Subject Re: why my page can't redirect under Struts with Javascript?
Date Mon, 20 Feb 2006 03:12:50 GMT
For the following:

document.forms[0].action="/log.do?action="+eval(tmp);

You'll need to prefix "/log.do" with your web context. Or you can use: 
<html:rewrite page='/log.do' /> in place of /log.do above.

hope it helps.
Saul


----- Original Message ----- 
From: "red phoenix" <rodphoenix@gmail.com>
To: <user@struts.apache.org>
Sent: Sunday, February 19, 2006 6:48 PM
Subject: why my page can't redirect under Struts with Javascript?


I use Javascript in Struts,like follows:

<script language="JavaScript">
function goURL(tmp){
alert(tmp);
document.forms[0].action="/log.do?action="+eval(tmp);
document.forms[0].submit();
}
</script>

<html:form method="post" action="log.do">
<html:link page="/log.do?action=First">First Page</html:link>
<html:select property="pageID" size="1" onchange="javascript:goURL(
this.options[this.selectedIndex].value)">
<option value="0">First</option>
<option value="1">Second</option>
<option value="2">Third</option>
</html:select>
</html:form>

when click "First Page",I can redirect my page to log.do page,but when I
change the value of select,and call goURL,I find my page don't redirect to
the log.do page,why? I am puzzled with it! Anybody can tell me how to
redirect my page with Javascript under Struts?

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message