Re: FW: R: Detecting the previous JSP
I strongly suggest to use DOM object model when programming JavaScript, since I do it my applications are accessed from Safari, IE, Firefox without problems and no browser dependent code is required. In your case I'd do this: 1. The html form: html:form action=/editRegistration onsubmit=validateRegistrationForm(this) styleId=myFrm Note that I have added the styleId attribute, this will be rendered as an id attribute when html is generated. The id attribute identify your html node in the node tree (in this case the form node). 2. The javascript function callDelete: we use DOM (http://www.w3.org/DOM) to locate a node and change its attributes: function callDelete() { frm = document.getElementById(myFrm); frm.setAttribute(action, /deleteRegistration); frm.submit(); } * With document.getElementById(...) you can locate an object of your html document if it has an id attribute. * With node.setAttribute(attributeName, value) you can modify the value of an attribute or add it if it doesn't exists. * And there are many other useful and simple methods you can use like getElementsByTagName, appendChild ... Try this for more information http://www.scottandrew.com/weblog/articles/dom_2 Hope this help. On Wed, 29 Sep 2004 16:29:39 -0400, Shabada, Gnaneshwer [EMAIL PROTECTED] wrote: All. I am posting again so that someone can shed some light on this.. I am trying to submit an action from a button thru a Javascript function. My Javascript code is : function callDelete() { document.forms[0].action=/deleteRegistration; document.forms[0].submit(); JS error } My JSP code is something like this: html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . . . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form When I click the UPDATE button, the default /editRegistration action is called. But when I click the Delete button I want to submit the /deleteRegistration thru JS function. I don't know why but I am getting this browser Javascript error saying Object doesn't support this property or method on the submit line (shown above). Am I doing anything wrong? Does struts html form support javascript action submission. Is there any other way to do this? Please help Gnan This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - 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: FW: R: Detecting the previous JSP
Did you forget to post it? I'm not seeing it here... Remember, it's the HTML as rendered on the browser, NOT what's in your JSP. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 10:27 am, Shabada, Gnaneshwer said: OK. Here is the html code from the JSP. Let me know if I am missing anything. Thanks for your help -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 5:05 PM To: Struts Users Mailing List Subject: Re: FW: R: Detecting the previous JSP Gnan, can you post the HTML that is generated by this? I.e., what you see when you do View Source in your browser... I have a hunch what's going on, but I need to see that to be sure... Shabada, Gnaneshwer wrote: All. I am posting again so that someone can shed some light on this.. I am trying to submit an action from a button thru a Javascript function. My Javascript code is : function callDelete() { document.forms[0].action=/deleteRegistration; document.forms[0].submit(); JS error } My JSP code is something like this: html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . . . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form When I click the UPDATE button, the default /editRegistration action is called. But when I click the Delete button I want to submit the /deleteRegistration thru JS function. I don't know why but I am getting this browser Javascript error saying Object doesn't support this property or method on the submit line (shown above). Am I doing anything wrong? Does struts html form support javascript action submission. Is there any other way to do this? Please help Gnan This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - 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: FW: R: Detecting the previous JSP
Oops, I sent it as an attachment. I guess the mailing list doesn't take it. Anyways, below is the rendered html code from my JSP. When I click the DELETE button, the JS error comes on line 38 i.e, as marked below..Let me know if you find anything Thanks for your help !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head base href=http://localhost:9080/registration/editregister.jsp; !-- COMPLETE THE CONTENT ATTRIBUTE FOR THE FOLLOWING META TAGS -- meta name=owner content=www.bisiadedokun.com meta name=description content=short description of page meta name=keywords content=put keywords here meta name=review content=MMDD meta name=security content=public or protected !-- EDITOR USED -- meta name=GENERATOR content=IBM WebSphere Page Designer V4.0 for Windows !-- STYLE SHEETS -- meta http-equiv=Content-Style-Type content=text/css link href=/registration/theme/Master.css rel=stylesheet type=text/css link href=/registration/theme/netscape.css rel=stylesheet type=text/css link href=/registration/theme/ie.css rel=stylesheet type=text/css style type=text/css/style !-- BEGIN MAIN -- titleMember Registration/title SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT /head body bgcolor=#ff table cellpadding=0 cellspacing=0 border=0 width=100% height=100 col span=1 width=39 tbody tr td width=148 height=38img src=/registration/images/odot.gif height=38 width=148 border=0/td td bgcolor=#99 width=39 height=38img src=/registration/images/odot.gif height=1 width=39 border=0/td td bgcolor=#99 height=38 colspan=2 table cellpadding=0 cellspacing=0 bgcolor=#99 width=100% border=0 tbody tr td align=center class=site-titleMember Registration/td !--TD align=rightimg src=/registration/images/ibm_logo_sm_fff.gif height=15 width=44 border=0/TD-- /tr /tbody /table /td td rowspan=4 bgcolor=#99img src=/registration/images/odot.gif height=1 width=10 border=0img src=/registration/images/odot.gif height=1 width=1 border=0/td /tr tr td height=33 rowspan=2/td td rowspan=4 width=39img src=/registration/images/odot.gif height=1 width=39 border=0/td td colspan=2nbsp;/td /tr tr td colspan=2 height=1 background=/registration/images/back_dots_66f.gif/td /tr tr td rowspan=2 valign=top height=650 bgcolor=#ffimg src=/registration/images/odot.gif height=1 width=1 border=0/td td rowspan=2 colspan=2 valign=top table border=0 width=100% cellpadding=0 cellspacing=0 tbody tr td!-- BEGIN OPTIONAL BREADCRUMBING --/td td rowspan=7 width=10img src=/registration/images/odot.gif height=10 width=10 border=0/td /tr !-- BEGIN PRIMARY CONTENT -- tr td class=headRegister/td /tr !-- tr tdfont color=#ff br /font/td /tr -- tr td class=subheadPlease update the following form:/td /tr tr tdimg src=/registration/images/asterisk.gif height=15 width=15 border=0 = a required field/td /tr tr td valign=topform name=registrationForm method=post action=/registration/editRegistration.do onsubmit=validateRegistrationForm(this)
RE: FW: R: Detecting the previous JSP
Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 10:54 am, Shabada, Gnaneshwer said: Oops, I sent it as an attachment. I guess the mailing list doesn't take it. Anyways, below is the rendered html code from my JSP. When I click the DELETE button, the JS error comes on line 38 i.e, as marked below..Let me know if you find anything Thanks for your help !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head base href=http://localhost:9080/registration/editregister.jsp; !-- COMPLETE THE CONTENT ATTRIBUTE FOR THE FOLLOWING META TAGS -- meta name=owner content=www.bisiadedokun.com meta name=description content=short description of page meta name=keywords content=put keywords here meta name=review content=MMDD meta name=security content=public or protected !-- EDITOR USED -- meta name=GENERATOR content=IBM WebSphere Page Designer V4.0 for Windows !-- STYLE SHEETS -- meta http-equiv=Content-Style-Type content=text/css link href=/registration/theme/Master.css rel=stylesheet type=text/css link href=/registration/theme/netscape.css rel=stylesheet type=text/css link href=/registration/theme/ie.css rel=stylesheet type=text/css style type=text/css/style !-- BEGIN MAIN -- titleMember Registration/title SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT /head body bgcolor=#ff table cellpadding=0 cellspacing=0 border=0 width=100% height=100 col span=1 width=39 tbody tr td width=148 height=38img src=/registration/images/odot.gif height=38 width=148 border=0/td td bgcolor=#99 width=39 height=38img src=/registration/images/odot.gif height=1 width=39 border=0/td td bgcolor=#99 height=38 colspan=2 table cellpadding=0 cellspacing=0 bgcolor=#99 width=100% border=0 tbody tr td align=center class=site-titleMember Registration/td !--TD align=rightimg src=/registration/images/ibm_logo_sm_fff.gif height=15 width=44 border=0/TD-- /tr /tbody /table /td td rowspan=4 bgcolor=#99img src=/registration/images/odot.gif height=1 width=10 border=0img src=/registration/images/odot.gif height=1 width=1 border=0/td /tr tr td height=33 rowspan=2/td td rowspan=4 width=39img src=/registration/images/odot.gif height=1 width=39 border=0/td td colspan=2nbsp;/td /tr tr td colspan=2 height=1 background=/registration/images/back_dots_66f.gif/td /tr tr td rowspan=2 valign=top height=650 bgcolor=#ffimg src=/registration/images/odot.gif height=1 width=1 border=0/td td rowspan=2 colspan=2 valign=top table border=0 width=100% cellpadding=0 cellspacing=0 tbody tr td!-- BEGIN OPTIONAL BREADCRUMBING --/td td rowspan=7 width=10img src=/registration/images/odot.gif height=10 width=10 border=0/td /tr !-- BEGIN PRIMARY CONTENT -- tr td class=headRegister/td /tr !-- tr tdfont color=#ff br /font/td /tr -- tr td class=subheadPlease update the following form:/td /tr tr
RE: FW: R: Detecting the previous JSP
Dohh!! that was silly of me :) Thanks Frank. Nice eye. I got rid of that JS problem now but it still wouldn't recognize my action on submit. I get the following error on my console. [9/30/04 11:27:48:550 EDT] 3324009f OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /deleteRegistration.do has not been defined I tried changing it to /deleteRegistration.do but no effect. I have it configured in my struts-config as action path=/deleteRegistration type=org.acaosa.registration.web.DeleteRegistrationAction name=deleteForm scope=request forward name=success path=/WEB-INF/view/searchResults.jsp /forward /action Not sure why it doesn't find it. Appreciate your help. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:21 AM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: R: Detecting the previous JSP
Never mind.. I think I am really being impatient..:) I found it, its the path to the action in the JS function. Had to set it to full path..it works now Thanks anyways -Original Message- From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:34 AM To: 'Struts Users Mailing List' Subject: RE: FW: R: Detecting the previous JSP Dohh!! that was silly of me :) Thanks Frank. Nice eye. I got rid of that JS problem now but it still wouldn't recognize my action on submit. I get the following error on my console. [9/30/04 11:27:48:550 EDT] 3324009f OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /deleteRegistration.do has not been defined I tried changing it to /deleteRegistration.do but no effect. I have it configured in my struts-config as action path=/deleteRegistration type=org.acaosa.registration.web.DeleteRegistrationAction name=deleteForm scope=request forward name=success path=/WEB-INF/view/searchResults.jsp /forward /action Not sure why it doesn't find it. Appreciate your help. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:21 AM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: R: Detecting the previous JSP
You shouldn't need to put the full path in, just setting the action to deleteRegistration.do should be sufficient (assuming it's a root path, meaning not something like /my/app/deleteRegistration. Not sure why it wouldn't work, looking at my own code that's what I have (i.e., NOT the full path) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 11:42 am, Shabada, Gnaneshwer said: Never mind.. I think I am really being impatient..:) I found it, its the path to the action in the JS function. Had to set it to full path..it works now Thanks anyways -Original Message- From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:34 AM To: 'Struts Users Mailing List' Subject: RE: FW: R: Detecting the previous JSP Dohh!! that was silly of me :) Thanks Frank. Nice eye. I got rid of that JS problem now but it still wouldn't recognize my action on submit. I get the following error on my console. [9/30/04 11:27:48:550 EDT] 3324009f OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /deleteRegistration.do has not been defined I tried changing it to /deleteRegistration.do but no effect. I have it configured in my struts-config as action path=/deleteRegistration type=org.acaosa.registration.web.DeleteRegistrationAction name=deleteForm scope=request forward name=success path=/WEB-INF/view/searchResults.jsp /forward /action Not sure why it doesn't find it. Appreciate your help. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:21 AM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - 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: FW: R: Detecting the previous JSP
Well. If I say document.forms[0].action=/registration/deleteRegistration.do; it doesn't recognize as registration is the context root of my app and the url was resolved as http://localhost:9080/deleteRegistration.do That is why it was giving me webGroup not found error. But when I set it to document.forms[0].action=/registration/deleteRegistration.do; it resolves to http://localhost:9080/registration/deleteRegistration.do and works..I thought the same as you did too, but I guess you need to give the relative path from context root. Gnan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 12:44 PM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP You shouldn't need to put the full path in, just setting the action to deleteRegistration.do should be sufficient (assuming it's a root path, meaning not something like /my/app/deleteRegistration. Not sure why it wouldn't work, looking at my own code that's what I have (i.e., NOT the full path) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 11:42 am, Shabada, Gnaneshwer said: Never mind.. I think I am really being impatient..:) I found it, its the path to the action in the JS function. Had to set it to full path..it works now Thanks anyways -Original Message- From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:34 AM To: 'Struts Users Mailing List' Subject: RE: FW: R: Detecting the previous JSP Dohh!! that was silly of me :) Thanks Frank. Nice eye. I got rid of that JS problem now but it still wouldn't recognize my action on submit. I get the following error on my console. [9/30/04 11:27:48:550 EDT] 3324009f OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /deleteRegistration.do has not been defined I tried changing it to /deleteRegistration.do but no effect. I have it configured in my struts-config as action path=/deleteRegistration type=org.acaosa.registration.web.DeleteRegistrationAction name=deleteForm scope=request forward name=success path=/WEB-INF/view/searchResults.jsp /forward /action Not sure why it doesn't find it. Appreciate your help. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:21 AM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email
RE: FW: R: Detecting the previous JSP
Well, certainly it it works, that's what counts :) But the path should be the path that is in your struts-config file, the physical path shouldn't matter, i.e., if your JSP in in the directory structure /my/app/jsp/part1, where /my is the root of the webapp, and you submit a form to /some/bogus/path/delete.do, it should work fine as long as that path your submitting to is valid in the config file. It's kind of a virtual vs. physical thing (that confused me at first frankly). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 1:26 pm, Shabada, Gnaneshwer said: Well. If I say document.forms[0].action=/registration/deleteRegistration.do; it doesn't recognize as registration is the context root of my app and the url was resolved as http://localhost:9080/deleteRegistration.do That is why it was giving me webGroup not found error. But when I set it to document.forms[0].action=/registration/deleteRegistration.do; it resolves to http://localhost:9080/registration/deleteRegistration.do and works..I thought the same as you did too, but I guess you need to give the relative path from context root. Gnan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 12:44 PM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP You shouldn't need to put the full path in, just setting the action to deleteRegistration.do should be sufficient (assuming it's a root path, meaning not something like /my/app/deleteRegistration. Not sure why it wouldn't work, looking at my own code that's what I have (i.e., NOT the full path) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 11:42 am, Shabada, Gnaneshwer said: Never mind.. I think I am really being impatient..:) I found it, its the path to the action in the JS function. Had to set it to full path..it works now Thanks anyways -Original Message- From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:34 AM To: 'Struts Users Mailing List' Subject: RE: FW: R: Detecting the previous JSP Dohh!! that was silly of me :) Thanks Frank. Nice eye. I got rid of that JS problem now but it still wouldn't recognize my action on submit. I get the following error on my console. [9/30/04 11:27:48:550 EDT] 3324009f OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /deleteRegistration.do has not been defined I tried changing it to /deleteRegistration.do but no effect. I have it configured in my struts-config as action path=/deleteRegistration type=org.acaosa.registration.web.DeleteRegistrationAction name=deleteForm scope=request forward name=success path=/WEB-INF/view/searchResults.jsp /forward /action Not sure why it doesn't find it. Appreciate your help. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 11:21 AM To: [EMAIL PROTECTED] Subject: RE: FW: R: Detecting the previous JSP Found the problem! Note that you have a submit button with the NAME submit... This is confusing the call to the submit() method in your JS function. Change the name of the button to submit1 or something and it'll work. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com SCRIPT language=Javascript function callDelete() { alert(Let's delete); document.forms[0].action=/deleteRegistration; alert(Let's delete again); document.forms[0].submit(); ERROR RIGHT HERE } /SCRIPT This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy
FW: R: Detecting the previous JSP
Frank, Thanks again. I ran around into another problem trying to implement this delete functionality. My member details (single delete) screen actually has 3 buttons for Update, Delete, Cancel. On this JSP my default action is /update in the form tag. But when I display my Delete button I am saying onclick call a Javascript function and trying to submit the form to a different action (i.e., /delete). Apparently, its not picking up the action and throwing a Webgroup not found error. My JS function is function callDelete() { document.forms[0].action=/deleteRegistration.do; document.forms[0].action.submit(); //alert(delete called); } and my jsp part is html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form I've seen solutions saying adopt LookupDispatch Action and all, but I think it can be acheived using JS too. Just wondering if Struts allow this or not. Gnan -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 12:59 PM To: Shabada, Gnaneshwer Subject: RE: R: Detecting the previous JSP Yes, I think two different mappings is not only a good idea, but is required. If we assume there's no way (aside from manually passing some flag in with the request) of determining which JSP it came from (and I'm almost completely certain that's the case), then the only way I believe to differentiate where the request came from is by looking at the mapping that was called. If you call the same mapping from both screens, obviously you can't make that determination. There's of course no problem with two different screens referencing the same mapping, but for your purposes I think they do have to be different. If you really do want to use the same mapping for whatever reason, you could simply add a query string to your form submissions (or link targets, whichever your using). That way it's slightly more obvious what your doing. For instance, you could have in your JSP's: a href=doDelete.do?srcJSP=page1 and on the other: a href=doDelete.do?srcJSP=page2 Then you can point your mapping to the same Action for both, and just grab the srcJSP parameter from the request, do your comparison and delegate appropriately. I'd personally have the two different mappings because then if you need to change something later it's just a config file entry rather than touching code (even if it is just a JSP). On the other hand, doing it in the JSP like that means you can make the change without restarting your app, which you'd have to do for the config file change to take effect... sarcasmDon't you just love when a simple question has such a straight-forward answer?!?/sarcasm -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 12:46 pm, Shabada, Gnaneshwer said: Ok. I totally agree with you. I like your idea better than DispatchAction bcuz first I am delegating my delete functionality to a facade based on the delete type and that runs only a couple lines of code. Making it Dispatch Action is a whole new ball game I think.. So, but now in my config I have only one Action Mapping say /delete pointing to my DeleteAction class. I was under assumption that I could call the same mapping from both the single delete screen and multiple delete screen. Do you think it's a good idea to have another mapping pointing to the the same DeleteAction class for multiple deletes and then use your logic to determine the mapping although the action they both point to is the same. Thanks much. -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 12:24 PM To: [EMAIL PROTECTED] Subject: Re: R: Detecting the previous JSP Thanks for forwarding to the list. There is a problem with the webmail interface I am forced to use from work, and my posts to the list get stuck in moderation, so I appreciate it! The DispatchAction might work, true enough, but to me it feels a little heavier than it needs to be... I am making the accumption that you have a single Action (I think you said that actually), but you have two different Action Mappings that point to it, one for the single delete and one for the multiple delete... It seems to me, assuming that is correct, that what I suggested might be easier. I personally prefer to see code in front of me when it's only a couple of lines, rather than having to look through a class hierarchy to find functionality in a parent class. With that in mind, just doing a quick IF based on the value of the path variable you get from my line of code, to me, feels more straight-forward. I guess what
FW: FW: R: Detecting the previous JSP
oh no, it's Client side. My browser gives Javascript error saying Object does't support this property or method on the submit line. I am starting to wonder, bcuz I've used this kind of calls in other non-struts apps so many times..or am making any obvious mistake on my JSP? -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 3:05 PM To: Shabada, Gnaneshwer Subject: RE: FW: R: Detecting the previous JSP When you say it blows up, do you mean your getting a CLIENT-SIDE error? I had assumed it was a server-side error. Obviously an important distinction :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 2:58 pm, Shabada, Gnaneshwer said: That alert line was commneted. Now, I moved it to the first line. It still blows up on document.forms[0].submit(); -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 2:53 PM To: Shabada, Gnaneshwer Subject: Re: FW: R: Detecting the previous JSP One other thing: your diagostic alert message I think has to come BEFORE the submit() call... I'm not 100% certain, but I'm pretty sure that line will never be reached when you submit. This might help in figuring out what's going on it nothing else. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 2:30 pm, Shabada, Gnaneshwer said: Frank, Thanks again. I ran around into another problem trying to implement this delete functionality. My member details (single delete) screen actually has 3 buttons for Update, Delete, Cancel. On this JSP my default action is /update in the form tag. But when I display my Delete button I am saying onclick call a Javascript function and trying to submit the form to a different action (i.e., /delete). Apparently, its not picking up the action and throwing a Webgroup not found error. My JS function is function callDelete() { document.forms[0].action=/deleteRegistration.do; document.forms[0].action.submit(); //alert(delete called); } and my jsp part is html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form I've seen solutions saying adopt LookupDispatch Action and all, but I think it can be acheived using JS too. Just wondering if Struts allow this or not. Gnan -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 12:59 PM To: Shabada, Gnaneshwer Subject: RE: R: Detecting the previous JSP Yes, I think two different mappings is not only a good idea, but is required. If we assume there's no way (aside from manually passing some flag in with the request) of determining which JSP it came from (and I'm almost completely certain that's the case), then the only way I believe to differentiate where the request came from is by looking at the mapping that was called. If you call the same mapping from both screens, obviously you can't make that determination. There's of course no problem with two different screens referencing the same mapping, but for your purposes I think they do have to be different. If you really do want to use the same mapping for whatever reason, you could simply add a query string to your form submissions (or link targets, whichever your using). That way it's slightly more obvious what your doing. For instance, you could have in your JSP's: a href=doDelete.do?srcJSP=page1 and on the other: a href=doDelete.do?srcJSP=page2 Then you can point your mapping to the same Action for both, and just grab the srcJSP parameter from the request, do your comparison and delegate appropriately. I'd personally have the two different mappings because then if you need to change something later it's just a config file entry rather than touching code (even if it is just a JSP). On the other hand, doing it in the JSP like that means you can make the change without restarting your app, which you'd have to do for the config file change to take effect... sarcasmDon't you just love when a simple question has such a straight-forward answer?!?/sarcasm -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 12:46 pm, Shabada, Gnaneshwer said: Ok. I totally agree with you. I like your idea better than DispatchAction bcuz first I am delegating my delete functionality to a facade based on the delete type and that runs only a couple lines of code. Making it Dispatch Action is a whole new ball game I think
RE: FW: R: Detecting the previous JSP
tried that too..and worse is html:form doesn't take a name attribute.. function callDelete() { alert(call delete); document.forms[0].action=/deleteRegistration; alert(call delete again); document.forms[0].submit(); JS error } -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 3:17 PM To: Shabada, Gnaneshwer Subject: RE: FW: R: Detecting the previous JSP Oh, ok, that makes a big difference :) The only thing I can see that looks a bit off to me is how your referencing the form... You might try giving the form a name and referencing it directly. OH, WAIT!! The submit line I'm pretty sure is wrong. Should be: document.forms[0].submit(); Give that a try, I'm pretty sure... -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 3:08 pm, Shabada, Gnaneshwer said: oh no, it's Client side. My browser gives Javascript error saying Object does't support this property or method on the submit line. I am starting to wonder, bcuz I've used this kind of calls in other non-struts apps so many times..or am making any obvious mistake on my JSP? -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 3:05 PM To: Shabada, Gnaneshwer Subject: RE: FW: R: Detecting the previous JSP When you say it blows up, do you mean your getting a CLIENT-SIDE error? I had assumed it was a server-side error. Obviously an important distinction :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 2:58 pm, Shabada, Gnaneshwer said: That alert line was commneted. Now, I moved it to the first line. It still blows up on document.forms[0].submit(); -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 2:53 PM To: Shabada, Gnaneshwer Subject: Re: FW: R: Detecting the previous JSP One other thing: your diagostic alert message I think has to come BEFORE the submit() call... I'm not 100% certain, but I'm pretty sure that line will never be reached when you submit. This might help in figuring out what's going on it nothing else. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, September 29, 2004 2:30 pm, Shabada, Gnaneshwer said: Frank, Thanks again. I ran around into another problem trying to implement this delete functionality. My member details (single delete) screen actually has 3 buttons for Update, Delete, Cancel. On this JSP my default action is /update in the form tag. But when I display my Delete button I am saying onclick call a Javascript function and trying to submit the form to a different action (i.e., /delete). Apparently, its not picking up the action and throwing a Webgroup not found error. My JS function is function callDelete() { document.forms[0].action=/deleteRegistration.do; document.forms[0].action.submit(); //alert(delete called); } and my jsp part is html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form I've seen solutions saying adopt LookupDispatch Action and all, but I think it can be acheived using JS too. Just wondering if Struts allow this or not. Gnan -Original Message- From: Frank W. Zammetti (MLists) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 12:59 PM To: Shabada, Gnaneshwer Subject: RE: R: Detecting the previous JSP Yes, I think two different mappings is not only a good idea, but is required. If we assume there's no way (aside from manually passing some flag in with the request) of determining which JSP it came from (and I'm almost completely certain that's the case), then the only way I believe to differentiate where the request came from is by looking at the mapping that was called. If you call the same mapping from both screens, obviously you can't make that determination. There's of course no problem with two different screens referencing the same mapping, but for your purposes I think they do have to be different. If you really do want to use the same mapping for whatever reason, you could simply add a query string to your form submissions (or link targets, whichever your using). That way it's slightly more obvious what your doing. For instance, you could have in your JSP's: a href=doDelete.do?srcJSP=page1 and on the other: a href=doDelete.do?srcJSP=page2 Then you can point your mapping to the same Action for both, and just grab the srcJSP parameter from
RE: FW: R: Detecting the previous JSP
All. I am posting again so that someone can shed some light on this.. I am trying to submit an action from a button thru a Javascript function. My Javascript code is : function callDelete() { document.forms[0].action=/deleteRegistration; document.forms[0].submit(); JS error } My JSP code is something like this: html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . . . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form When I click the UPDATE button, the default /editRegistration action is called. But when I click the Delete button I want to submit the /deleteRegistration thru JS function. I don't know why but I am getting this browser Javascript error saying Object doesn't support this property or method on the submit line (shown above). Am I doing anything wrong? Does struts html form support javascript action submission. Is there any other way to do this? Please help Gnan This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: R: Detecting the previous JSP
Gnan, can you post the HTML that is generated by this? I.e., what you see when you do View Source in your browser... I have a hunch what's going on, but I need to see that to be sure... Shabada, Gnaneshwer wrote: All. I am posting again so that someone can shed some light on this.. I am trying to submit an action from a button thru a Javascript function. My Javascript code is : function callDelete() { document.forms[0].action=/deleteRegistration; document.forms[0].submit(); JS error } My JSP code is something like this: html:form action=/editRegistration onsubmit=validateRegistrationForm(this) . so on.. . . . html:submit property=submit bean:message key=button.update / /html:submit html:submit onclick=javascipt:callDelete(); bean:message key=button.delete / /html:submit /html:form When I click the UPDATE button, the default /editRegistration action is called. But when I click the Delete button I want to submit the /deleteRegistration thru JS function. I don't know why but I am getting this browser Javascript error saying Object doesn't support this property or method on the submit line (shown above). Am I doing anything wrong? Does struts html form support javascript action submission. Is there any other way to do this? Please help Gnan This email message is for the sole use of the intended recipient (s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. To reply to our email administrator directly, send an email to [EMAIL PROTECTED] Toys R Us, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]