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]
RE: why my page can't redirect under Struts with Javascript?
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]
Re: why my page can't redirect under Struts with Javascript?
Hi, I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } Is eval really needed? . Check whether you really need /Log in contexet path? Try wih following function. function goURL(tmp){ document.forms[0].action=/log.do?action=First; document.forms[0].submit(); } On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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
Re: why my page can't redirect under Struts with Javascript?
Swapnil Patil wrote: Hi, I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } Is eval really needed? . Check whether you really need /Log in contexet path? Try wih following function. function goURL(tmp){ document.forms[0].action=/log.do?action=First; document.forms[0].submit(); } Hmm. Why the action has to be inserted to the url in the first place? Can't the log.do retrieve in as getAction() in the execute? It's the value of the combobox and should be readable from the form bean. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
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! And I try function goURL(tmp){ document.forms[0].submit(); } I find my page still can't redirect!!! but I can use following statement to redirect page, html:submit property=c value=go/ why javascript can't redirect under Struts,and html:submit can redirect in the same page? It puzzled me for a very long time. It almost mad me mad. On 2/20/06, Jari Fredriksson [EMAIL PROTECTED] wrote: Swapnil Patil wrote: Hi, I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } Is eval really needed? . Check whether you really need /Log in contexet path? Try wih following function. function goURL(tmp){ document.forms[0].action=/log.do?action=First; document.forms[0].submit(); } Hmm. Why the action has to be inserted to the url in the first place? Can't the log.do retrieve in as getAction() in the execute? It's the value of the combobox and should be readable from the form bean. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
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]
Re: why my page can't redirect under Struts with Javascript?
Dave- If you are looking for a way for JavaScript to dynamically change targetting action based on Javascript code take a look at http://husted.com/struts/tips/002.html HTH, Martin - Original Message - From: Dave Newton [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, February 20, 2006 8:17 PM Subject: Re: why my page can't redirect under Struts with Javascript? 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
Sorry, my bad, I didn't even think about that. Right, you don't need the eval here. Saul - Original Message - From: Dave Newton [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, February 20, 2006 7:17 PM Subject: Re: why my page can't redirect under Struts with Javascript? 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
Martin Gainty wrote: If you are looking for a way for JavaScript to dynamically change targetting action based on Javascript code take a look at http://husted.com/struts/tips/002.html Uh, no, I was answering the OP with regards to his hosed up JavaScript :) Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
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]
Re: why my page can't redirect under Struts with Javascript?
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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why my page can't redirect under Struts with Javascript?
Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thanks Regards Swapnil Patil.
Re: why my page can't redirect under Struts with Javascript?
I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thanks Regards Swapnil Patil.
Re: why my page can't redirect under Struts with Javascript?
modify your javascript like this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } and try... On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
Re: why my page can't redirect under Struts with Javascript?
when I Javascript execute var url = %=response.encodeURL(/Log/log.do)%; IE raise script error: Raise error during running period,debug or not Line:81 Error:missing ';' On 2/20/06, raja sekar [EMAIL PROTECTED] wrote: modify your javascript like this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } and try... On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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=FirstFirst Page/html:link html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=0First/option option value=1Second/option option value=2Third/option /html:select /html:form when click First Page,I can redirect my page to log.dopage,but when I change the value
Re: why my page can't redirect under Struts with Javascript?
try this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: when I Javascript execute var url = %=response.encodeURL(/Log/log.do)%; IE raise script error: Raise error during running period,debug or not Line:81 Error:missing ';' On 2/20/06, raja sekar [EMAIL PROTECTED] wrote: modify your javascript like this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } and try... On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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
Re: why my page can't redirect under Struts with Javascript?
I have tried function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; alert(url + ?action= + tmp); document.forms[0].submit(); } Javascript can alert the right information,such as /Log/log.do?action=3 But the page still can't redirect! Why can't redirect? On 2/20/06, raja sekar [EMAIL PROTECTED] wrote: try this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: when I Javascript execute var url = %=response.encodeURL(/Log/log.do)%; IE raise script error: Raise error during running period,debug or not Line:81 Error:missing ';' On 2/20/06, raja sekar [EMAIL PROTECTED] wrote: modify your javascript like this function goURL(tmp){ var url = %=response.encodeURL(/Log/log.do)%; document.forms[0].action=url + ?action= + tmp; document.forms[0].submit(); } and try... On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I modify my Javascript like follows: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=First); document.forms[0].submit(); } But when I change the value of html:select,it still can't redirect. I am mad with it! On 2/20/06, Swapnil Patil [EMAIL PROTECTED] wrote: Hi red, html:link page=/log.do?action=FirstFirst Page/html:link this works with action parameter containing value= First NOT 0. Your 'tmp' variable in script function contains value 0,1 or 2. Your log.do action might be checking content of action parameter with values First, Second or Third Try it again with following manner. html:select property=pageID size=1 onchange=javascript:goURL( this.options[this.selectedIndex].value) option value=FirstFirst/option option value=SecondSecond/option option value=ThirdThird/option /html:select I hope it will work. On 2/20/06, red phoenix [EMAIL PROTECTED] wrote: I have try follows two method: function goURL(tmp){ document.forms[0].action=eval(/Log/log.do?action=+tmp); alert(eval(/Log/log.do?action=+tmp)); document.forms[0].submit(); } and function goURL(tmp){ var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; alert(newAct) document.forms[0].submit(); } I find Javasript can alert right value,such as /Log/log.do?action=3 but I find Javascript don't redirect any page,my action don't be called! Why? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: A few things here, 1) I think you need build the action like the following; document.forms[0].action=eval(/Log/log.do?action=+tmp); or do it in two steps: var newAct = /Log/log.do?action=+tmp; document.forms[0].action = newAct; 2) how are you checking the action parameter in your Action class, checking action=First or action=0? the above will give you action=0, or action=1 etc, but not action=First, action=Second. The reason I ask the question is b/c you mentioned html:link page=/log.do?action=FirstFirst Page/html:link works for you, you are passing a First to the action in this case. Saul - Original Message - From: red phoenix [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, February 19, 2006 10:12 PM Subject: Re: why my page can't redirect under Struts with Javascript? My web context is Log,so I add prefix before,like follows: document.forms[0].action=/Log/log.do?action=+eval(tmp); but when I change the value of html:select,it still can't redirect,I am puzzled it for several days.I don't know why it don't redirect!!! I want to use above code to make a pagination program,the html:select shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected one of items of html:select,it will call Javascript and redirect page to a action. Anybody can give me some adivce? On 2/20/06, Saul Qunming Yuan [EMAIL PROTECTED] wrote: 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