html:image - running into an infinite loop
Hi, I have read old mails regarding the html:image implementation and the recommendations related to identifying which image is clicked in the form. For reference is used Ted's - 'Struts Tip #1 - Use an ImageButtonBean to represent an image button' @ http://husted.com/struts/tips/001.html My problem is a step further in the same. I will try my best to explain it, I hope I get it right. I have a mainpage which has many image buttons, they all map to different actions that they must perform. Once the image is clicked, I identify the image and perform the relevant action by forwarding the call to the relevant action mapping. Most actions have a .jsp (UI) and action class and are defined in the struts-config.xml part shown below: struts-config form-beans form-bean name=dataForm type=com.data.struts.form.DataForm /form-bean /form-beans global-forwards forward name=getData path=/getData.do/ forward name=resetData path=/resetData.do/ /global-forwards action-mappings action path=/getData type=com.data.struts.action.DataAction name=dataForm scope=request input=/jsp/dataForm.jsp forward name=success path=/jsp/dataForm.jsp/ /action action path=/resetData type=com.data.struts.action.ResetDataAction name=dataForm scope=request forward name=success path=/getData.do/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config In my case DataAction class receives the click event and forward the call to /resetData. //as below if (dataForm.getRestButton().pressed() errors == null) { Log.debug(RESET BUTTON :+ dataForm. getRestButton ().getName() +, X : + dataForm. getRestButton ().getX() +, Y : + dataForm. getRestButton ().getY()); return (mapping.findForward(resetData)); } The ResetDataAction process the request (does some thing) and must return back to the caller - forward to /getData finally. //as below mapping.findForward(getData) All button handling working fine and I can do the processing in ResetDataAction but the problem start when I forward the call back to /getData. The call forward to DataAction class but the button click is identified and the call gets forwarded back to /resetData and then back here I get into a loop. I tried to reset on the form (which is common to both action classes) but no success, I tried explicitly setting the button beans X Y values to null, still no success. What I could do was do the process I was doing in ResetDataAction in DataAction but that is not what I would like to do. I want to keep the two implementations separate as one only delegates and the other does some processing. Can someone throw more light onto this? I have been reading a lot but have not come across a person who faced a similar problem. It may be something really basic but I can't solve it the way I want and it's bothering me. Any help on this will be much appreciated. Thanks in advance, Anuj __ NOTICE: This communication and any files transmitted with it (communication) may contain privileged or other confidential information. This communication is intended solely for the individual or entity to whom it is addressed. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use this communication. Also, please indicate to the sender that you have received this communication in error, and then delete this communication and any copies. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:image - running into an infinite loop
The problem you are having, is that each time you forward to an action then struts will re-populate the form from the request. That is why you are getting into a loop - when your ResetDataAction forwards back to getData - the action for getData is having the form re-populated from the request, including the x, y co-ordinates. If you did a redirect then you would effectively get a whole new request, but you would loose everything, not just the x, y co-ordinates. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 12, 2004 2:11 PM Subject: html:image - running into an infinite loop Hi, I have read old mails regarding the html:image implementation and the recommendations related to identifying which image is clicked in the form. For reference is used Ted's - 'Struts Tip #1 - Use an ImageButtonBean to represent an image button' @ http://husted.com/struts/tips/001.html My problem is a step further in the same. I will try my best to explain it, I hope I get it right. I have a mainpage which has many image buttons, they all map to different actions that they must perform. Once the image is clicked, I identify the image and perform the relevant action by forwarding the call to the relevant action mapping. Most actions have a .jsp (UI) and action class and are defined in the struts-config.xml part shown below: struts-config form-beans form-bean name=dataForm type=com.data.struts.form.DataForm /form-bean /form-beans global-forwards forward name=getData path=/getData.do/ forward name=resetData path=/resetData.do/ /global-forwards action-mappings action path=/getData type=com.data.struts.action.DataAction name=dataForm scope=request input=/jsp/dataForm.jsp forward name=success path=/jsp/dataForm.jsp/ /action action path=/resetData type=com.data.struts.action.ResetDataAction name=dataForm scope=request forward name=success path=/getData.do/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config In my case DataAction class receives the click event and forward the call to /resetData. //as below if (dataForm.getRestButton().pressed() errors == null) { Log.debug(RESET BUTTON :+ dataForm. getRestButton ().getName() +, X : + dataForm. getRestButton ().getX() +, Y : + dataForm. getRestButton ().getY()); return (mapping.findForward(resetData)); } The ResetDataAction process the request (does some thing) and must return back to the caller - forward to /getData finally. //as below mapping.findForward(getData) All button handling working fine and I can do the processing in ResetDataAction but the problem start when I forward the call back to /getData. The call forward to DataAction class but the button click is identified and the call gets forwarded back to /resetData and then back here I get into a loop. I tried to reset on the form (which is common to both action classes) but no success, I tried explicitly setting the button beans X Y values to null, still no success. What I could do was do the process I was doing in ResetDataAction in DataAction but that is not what I would like to do. I want to keep the two implementations separate as one only delegates and the other does some processing. Can someone throw more light onto this? I have been reading a lot but have not come across a person who faced a similar problem. It may be something really basic but I can't solve it the way I want and it's bothering me. Any help on this will be much appreciated. Thanks in advance, Anuj __ NOTICE: This communication and any files transmitted with it (communication) may contain privileged or other confidential information. This communication is intended solely for the individual or entity to whom it is addressed. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use this communication. Also, please indicate to the sender that you have received this communication in error, and then delete this communication and any copies. Thank you. - 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: html:image - running into an infinite loop
Niall, Thanks for the help. Atleast now I know where to look to solve the problem. My next question, how to remove / reset the button parameters (x y) in the Request? I need the other parameters to stay (sort of refresh / repost, but don't want to go back to 'ResetDataAction') . -Anuj Response to: html:image - running into an infinite loop ([EMAIL PROTECTED]) From: Niall Pemberton [EMAIL PROTECTED] Subject: html:image - running into an infinite loop Date: Fri, 12 Mar 2004 15:03:02 - Content-Type: text/plain; charset=iso-8859-1 The problem you are having, is that each time you forward to an action then struts will re-populate the form from the request. That is why you are getting into a loop - when your ResetDataAction forwards back to getData - the action for getData is having the form re-populated from the request, including the x, y co-ordinates. If you did a redirect then you would effectively get a whole new request, but you would loose everything, not just the x, y co-ordinates. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 12, 2004 2:11 PM Subject: html:image - running into an infinite loop Hi, I have read old mails regarding the html:image implementation and the recommendations related to identifying which image is clicked in the form. For reference is used Ted's - 'Struts Tip #1 - Use an ImageButtonBean to represent an image button' @ http://husted.com/struts/tips/001.html My problem is a step further in the same. I will try my best to explain it, I hope I get it right. I have a mainpage which has many image buttons, they all map to different actions that they must perform. Once the image is clicked, I identify the image and perform the relevant action by forwarding the call to the relevant action mapping. Most actions have a .jsp (UI) and action class and are defined in the struts-config.xml part shown below: struts-config form-beans form-bean name=dataForm type=com.data.struts.form.DataForm /form-bean /form-beans global-forwards forward name=getData path=/getData.do/ forward name=resetData path=/resetData.do/ /global-forwards action-mappings action path=/getData type=com.data.struts.action.DataAction name=dataForm scope=request input=/jsp/dataForm.jsp forward name=success path=/jsp/dataForm.jsp/ /action action path=/resetData type=com.data.struts.action.ResetDataAction name=dataForm scope=request forward name=success path=/getData.do/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config In my case DataAction class receives the click event and forward the call to /resetData. //as below if (dataForm.getRestButton().pressed() errors == null) { Log.debug(RESET BUTTON :+ dataForm. getRestButton ().getName() +, X : + dataForm. getRestButton ().getX() +, Y : + dataForm. getRestButton ().getY()); return (mapping.findForward(resetData)); } The ResetDataAction process the request (does some thing) and must return back to the caller - forward to /getData finally. //as below mapping.findForward(getData) All button handling working fine and I can do the processing in ResetDataAction but the problem start when I forward the call back to /getData. The call forward to DataAction class but the button click is identified and the call gets forwarded back to /resetData and then back here I get into a loop. I tried to reset on the form (which is common to both action classes) but no success, I tried explicitly setting the button beans X Y values to null, still no success. What I could do was do the process I was doing in ResetDataAction in DataAction but that is not what I would like to do. I want to keep the two implementations separate as one only delegates and the other does some processing. Can someone throw more light onto this? I have been reading a lot but have not come across a person who faced a similar problem. It may be something really basic but I can't solve it the way I want and it's bothering me. Any help on this will be much appreciated. Thanks in advance, Anuj __ NOTICE: This communication and any files transmitted with it (communication) may contain privileged or other confidential information. This communication is intended solely for the individual or entity to whom it is addressed. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use this communication. Also, please indicate to the sender that you have received this communication in error, and then delete this communication and any copies. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
Validate method going in infinite Loop
Hi All, I am validating email address entered by user, using in validate method of formBean. If the email address is invalid I am adding the errors. Struts Config entries: action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action OR action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/emailcreation.mo forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action Second one is going into the loop and first one is not getting the values from database as the request is going to JSP not to action class i.e the formbean values are not populate. How can I overcome this problem. Thanks in Advance Regards Pankaj Borgaonkar Wipro Technologies **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ***
Re: Validate method going in infinite Loop
hi pankaj, action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/emailcreation.mo" forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//action ** this action mapping goes into a infinite loop , becos, if u find an error ur calling emailcreation.mo(input parameter). that is it is calling itself. and hence infinte loop. everytime u call emailcreation.mo , validate method will be called. action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//action** this seems to be ok , becos ur forwarding the controll to /jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp(input parameter) and the jsp page should display ur error. and if u want to get data from db(for validation) , get it from validate method only. ur control will never go action class unless all the validations are success.. --nagi ---Original Message--- From: Struts Users Mailing List Date: Thursday, July 10, 2003 12:11:05 PM To: [EMAIL PROTECTED] Subject: Validate method going in infinite Loop Hi All,I am validating email address entered by user, using in validate methodof formBean. If the email address is invalid I am adding the errors. Struts Config entries:action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//actionORaction path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/emailcreation.mo" forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//actionSecond one is going into the loop and first one is not getting thevalues from database as the request is going to JSP not to action classi.e the formbean values are not populate.How can I overcome this problem.Thanks in Advance RegardsPankaj BorgaonkarWipro Technologies**DisclaimerInformation contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individualor entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited.*** IncrediMail - Email has finally evolved - Click Here
RE: Validate method going in infinite Loop
Thanks Nagendra But on the JSP page I want to show both the errors as well as the data ( form bean variable which are populated in the performAction() method of action class. ) i.e. in validate method if email address is invalid then I am adding the errors and forwarding to JSP page, this page will show the errors only but not the formbean values as it has not gone into the performAction(). So I need to show the errors also and the data also from database. This data is not used for validating the email address but it is used for showing some suggested email addresses. Please reply Pankaj -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 12:43 PM To: [EMAIL PROTECTED] Subject: Re: Validate method going in infinite Loop hi pankaj, action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/emailcreation.mo forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action ** this action mapping goes into a infinite loop , becos, if u find an error ur calling emailcreation.mo(input parameter). that is it is calling itself. and hence infinte loop. everytime u call emailcreation.mo , validate method will be called. action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action ** this seems to be ok , becos ur forwarding the controll to /jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp(input parameter) and the jsp page should display ur error. and if u want to get data from db(for validation) , get it from validate method only. ur control will never go action class unless all the validations are success.. --nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Thursday, July 10, 2003 12:11:05 PM To: [EMAIL PROTECTED] Subject: Validate method going in infinite Loop Hi All, I am validating email address entered by user, using in validate method of formBean. If the email address is invalid I am adding the errors. Struts Config entries: action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action OR action path=/emailcreation type=com.onstar.myonstar.process.web.controller.EmailCreationAction name=emailCreationForm validate=true scope=request input=/emailcreation.mo forward name=emailcreation_page path=/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp redirect=false/ /action Second one is going into the loop and first one is not getting the values from database as the request is going to JSP not to action class i.e the formbean values are not populate. How can I overcome this problem. Thanks in Advance Regards Pankaj Borgaonkar Wipro Technologies **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *** http://www.incredimail.com/redir.asp?ad_id=309lang=9 IncrediMail - Email has finally evolved - http://www.incredimail.com/redir.asp?ad_id=309lang=9 Click Here **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ***
RE: Validate method going in infinite Loop
hi, well then.. do not perform any validations in the validate method. (leave it empty). do this email validation in the action class. so if ur email is invalid add that to errors and also get other data from db and then forward to jsp. so this will display both ur error and other db data make sure u create the errors object as usual and u shoud save those errors to the request object using saveErrors(errors,request) --nagi ---Original Message--- From: Pankaj Borgaonkar Date: Thursday, July 10, 2003 12:45:24 PM To: Struts Users Mailing List; Nagendra Kumar O V S Subject: RE: Validate method going in infinite Loop Thanks Nagendra But on the JSP page Iwant to show both the errors as well as the data( form bean variable which are populated in the performAction() method of action class. ) i.e. in validate method if email address is invalid then I am adding the errors and forwarding to JSP page, this page will show the errors only but not the formbean values as it has not gone into the performAction(). So I need to show the errors also and the data also from database. This data is not used for validating the email address but it is used for showing some suggested email addresses. Please reply Pankaj -Original Message-From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 12:43 PMTo: [EMAIL PROTECTED]Subject: Re: Validate method going in infinite Loop hi pankaj, action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/emailcreation.mo" forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//action ** this action mapping goes into a infinite loop , becos, if u find an error ur calling emailcreation.mo(input parameter). that is it is calling itself. and hence infinte loop. everytime u call emailcreation.mo , validate method will be called. action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//action** this seems to be ok , becos ur forwarding the controll to /jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp(input parameter) and the jsp page should display ur error. and if u want to get data from db(for validation) , get it from validate method only. ur control will never go action class unless all the validations are success.. --nagi ---Original Message--- From: Struts Users Mailing List Date: Thursday, July 10, 2003 12:11:05 PM To: [EMAIL PROTECTED] Subject: Validate method going in infinite Loop Hi All,I am validating email address entered by user, using in validate methodof formBean. If the email address is invalid I am adding the errors. Struts Config entries:action path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreationForm" validate="true"scope="request"input="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"forward name="emailcreation_page"path="/jsp/virtualadvisor/emailcreation/va_pr_emailsetup_main.jsp"redirect="false"//actionORaction path="/emailcreation" type="com.onstar.myonstar.process.web.controller.EmailCreationAction" name="emailCreat
is this a bug? (error-code 400 map to an Action result an infinite loop that kill the server)
Hi all, I was using the TilesRequestProcessor, with 1.1b1. When I tried to map: error-page error-code400/error-code location/test/errorHandler.do/location /error-page in my web.xml. My weblogic run into an infinite loop and crash. It works just find if I map it to a JSP/Html page. Is this a bug? Thanks, danny
Re: is this a bug? (error-code 400 map to an Action result an infinite loop that kill the server)
On Thu, 15 Aug 2002, Trieu, Danny wrote: Date: Thu, 15 Aug 2002 19:55:10 -0700 From: Trieu, Danny [EMAIL PROTECTED] Reply-To: Struts Developers List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED], '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: is this a bug? (error-code 400 map to an Action result an infinit e loop that kill the server) Hi all, I was using the TilesRequestProcessor, with 1.1b1. When I tried to map: error-page error-code400/error-code location/test/errorHandler.do/location /error-page in my web.xml. My weblogic run into an infinite loop and crash. It works just find if I map it to a JSP/Html page. Is this a bug? Yes ... but it's a bug in WebLogic, not Struts. Obviously, servers should not allow an application to cause them to crash. Thanks, danny Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
infinite loop
I am working on a very tight project and have myself proposed struts implementation. The proposal is accepted and i am in the process of designing the existing application to make it struts aware.I am running into a peculiar problem. Here are the details: My homepage is located under /administration/adminmain.jsp I have the following settings in web.xml file servlet-mapping servlet-nameaction/servlet-name url-pattern/administration/*/url-pattern /servlet-mapping This will force the above homepage request to go through the action class as per the servlet mapping.I have the following mapping in the struts-config.xml file action path=/adminmain.jsp parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action Outcome: With the above mapping , the request to adminmain.jsp will invoke the ForwardAction class and the RequestDispatcher class also but this will loop back through the action class and again to ForwardAction. This goes on in an infinite loop and my weblogic crashes. Please let me know how i should be solving this problem. You have been very helpful for all my struts related questions and i really appreciate if you could save me from this titanic. Awaiting your response and thanks in advance. Thanks Srivatsa Kadambi Digital GlobalSoft Ltd (A Subsidiary of Hewlett-Packard Co., USA ) Digital Centre, 3rd Floor , Khanija Bhavan #49,Race Course Road, Bangalore-560001 Tel: 91-80-2268003 Extn:4241 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: infinite loop
action path=/adminmain.jsp ^ This is probably causing you the most grief. James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Kadambi, Srivatsa [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:32 AM To: [EMAIL PROTECTED] Subject: infinite loop I am working on a very tight project and have myself proposed struts implementation. The proposal is accepted and i am in the process of designing the existing application to make it struts aware.I am running into a peculiar problem. Here are the details: My homepage is located under /administration/adminmain.jsp I have the following settings in web.xml file servlet-mapping servlet-nameaction/servlet-name url-pattern/administration/*/url-pattern /servlet-mapping This will force the above homepage request to go through the action class as per the servlet mapping.I have the following mapping in the struts-config.xml file action path=/adminmain.jsp parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action Outcome: With the above mapping , the request to adminmain.jsp will invoke the ForwardAction class and the RequestDispatcher class also but this will loop back through the action class and again to ForwardAction. This goes on in an infinite loop and my weblogic crashes. Please let me know how i should be solving this problem. You have been very helpful for all my struts related questions and i really appreciate if you could save me from this titanic. Awaiting your response and thanks in advance. Thanks Srivatsa Kadambi Digital GlobalSoft Ltd (A Subsidiary of Hewlett-Packard Co., USA ) Digital Centre, 3rd Floor , Khanija Bhavan #49,Race Course Road, Bangalore-560001 Tel: 91-80-2268003 Extn:4241 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: infinite loop
He means it should be like this (drop the jsp): action path=/adminmain parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action or anything you like for the path, for that matter: action path=/admin parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:57 PM To: Struts Users Mailing List Subject: RE: infinite loop action path=/adminmain.jsp ^ This is probably causing you the most grief. James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Kadambi, Srivatsa [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:32 AM To: [EMAIL PROTECTED] Subject: infinite loop I am working on a very tight project and have myself proposed struts implementation. The proposal is accepted and i am in the process of designing the existing application to make it struts aware.I am running into a peculiar problem. Here are the details: My homepage is located under /administration/adminmain.jsp I have the following settings in web.xml file servlet-mapping servlet-nameaction/servlet-name url-pattern/administration/*/url-pattern /servlet-mapping This will force the above homepage request to go through the action class as per the servlet mapping.I have the following mapping in the struts-config.xml file action path=/adminmain.jsp parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action Outcome: With the above mapping , the request to adminmain.jsp will invoke the ForwardAction class and the RequestDispatcher class also but this will loop back through the action class and again to ForwardAction. This goes on in an infinite loop and my weblogic crashes. Please let me know how i should be solving this problem. You have been very helpful for all my struts related questions and i really appreciate if you could save me from this titanic. Awaiting your response and thanks in advance. Thanks Srivatsa Kadambi Digital GlobalSoft Ltd (A Subsidiary of Hewlett-Packard Co., USA ) Digital Centre, 3rd Floor , Khanija Bhavan #49,Race Course Road, Bangalore-560001 Tel: 91-80-2268003 Extn:4241 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: infinite loop
To where are you forwarding the request? Mark -Original Message- From: Kadambi, Srivatsa [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:32 AM I am working on a very tight project and have myself proposed struts implementation. The proposal is accepted and i am in the process of designing the existing application to make it struts aware.I am running into a peculiar problem. Here are the details: My homepage is located under /administration/adminmain.jsp I have the following settings in web.xml file servlet-mapping servlet-nameaction/servlet-name url-pattern/administration/*/url-pattern /servlet-mapping This will force the above homepage request to go through the action class as per the servlet mapping.I have the following mapping in the struts-config.xml file action path=/adminmain.jsp parameter=/administration/adminmain.jsp scope=request type=org.apache.struts.actions.ForwardAction validate=false /action Outcome: With the above mapping , the request to adminmain.jsp will invoke the ForwardAction class and the RequestDispatcher class also but this will loop back through the action class and again to ForwardAction. This goes on in an infinite loop and my weblogic crashes. Please let me know how i should be solving this problem. You have been very helpful for all my struts related questions and i really appreciate if you could save me from this titanic. Awaiting your response and thanks in advance. Thanks -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Validator going into infinite loop
What version of Struts are you using and what version of the Validator? David --- Mike Bridge [EMAIL PROTECTED] wrote: Hi- When I submit (or access) a ValidatorForm, it goes into an infinite loop. I had this working with 0.5, but after upgrading, it doesn't seem to function any more. I've done the following to set it up: 1) set up a validator.xml from the example, removing the existing bean definition and adding: formset form name=surveyForm field property=givenname depends=required arg0 key=form.givenname/ /field field property=familyname depends=required arg0 key=form.familyname/ /field field property=email depends=required,email arg0 key=form.email/ /field /form /formset 2) Added the following to my struts-config.xml form-beans form-bean name=surveyForm type=ca.oldring.forms.SurveyForm/ /form-beans global-forwards forward name=survey1_en path=/survey1.jsp?language=en/ forward name=survey1_fr path=/survey1.jsp?language=fr/ /global-forwards action-mappings !-- Process a survey -- actionpath=/survey type=ca.oldring.actions.SurveyAction name=surveyForm scope=request validate=true input=/survey.do forward name=thanks path=/thanks.jsp/ /action /action-mappings 3) Made a bean SurveyForm with generic get and set methods 4) Set up web.xml: servlet servlet-namevalidator/servlet-name servlet-classcom.wintecinc.struts.action.ValidatorServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/validation.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param load-on-startup3/load-on-startup /servlet 5) copied the tld and the Struts_Validator-20010702.jar When I access the survey.do file, the tomcat servlet log gives me this until java segfaults: 2001-09-17 16:53:40 - path=/survey :action: Processing a GET for /survey 2001-09-17 16:53:40 - path=/survey :action: Setting locale 'en' 2001-09-17 16:53:40 - path=/survey :action: Looking for ActionForm bean under attribute 'surveyForm' 2001-09-17 16:53:40 - path=/survey :action: Creating new ActionForm instance of class 'ca.oldring.forms.SurveyForm' 2001-09-17 16:53:40 - path=/survey :action: Storing instance under attribute 'surveyForm' in scope 'request' 2001-09-17 16:53:40 - path=/survey :action: Populating bean properties from this request 2001-09-17 16:53:40 - path=/survey :action: Validating input form properties 2001-09-17 16:53:40 - path=/survey :action: Validation error(s), redirecting to: /survey.do 2001-09-17 16:53:40 - path=/survey :action: Processing a GET for /survey ... Any ideas on why this is looping? It doesn't appear to be reaching my Action class. Thanks, -Mike -- Mike Bridge [EMAIL PROTECTED] __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Re: Validator going into infinite loop
Hi David, I'm using Struts_Validator-2001100702.jar with Struts 1.0. I am confused about how to make this work, so I turned the automatic validation off and validated it manually in my Action class, the same way as in the multipage form example. I'm not sure where I went wrong, but I had troubles setting it up with input=/survey.do. Validation worked when I set input=/survey.jsp. -Mike On Thu, Sep 20, 2001 at 08:08:05AM -0700, David Winterfeldt wrote: What version of Struts are you using and what version of the Validator? David 5) copied the tld and the Struts_Validator-20010702.jar -- Mike Bridge [EMAIL PROTECTED]
Re: Validator going into infinite loop
I didn't pay attention that you had your input set to the action. Since you had valdiate=true, it would try to validate before the Action's perform method was called, but if validation failed it would try to go to the action again. So it would validate, fail, go to the action, etc. David --- Mike Bridge [EMAIL PROTECTED] wrote: Hi David, I'm using Struts_Validator-2001100702.jar with Struts 1.0. I am confused about how to make this work, so I turned the automatic validation off and validated it manually in my Action class, the same way as in the multipage form example. I'm not sure where I went wrong, but I had troubles setting it up with input=/survey.do. Validation worked when I set input=/survey.jsp. -Mike On Thu, Sep 20, 2001 at 08:08:05AM -0700, David Winterfeldt wrote: What version of Struts are you using and what version of the Validator? David 5) copied the tld and the Struts_Validator-20010702.jar -- Mike Bridge [EMAIL PROTECTED] __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Validator going into infinite loop
Hi- When I submit (or access) a ValidatorForm, it goes into an infinite loop. I had this working with 0.5, but after upgrading, it doesn't seem to function any more. I've done the following to set it up: 1) set up a validator.xml from the example, removing the existing bean definition and adding: formset form name=surveyForm field property=givenname depends=required arg0 key=form.givenname/ /field field property=familyname depends=required arg0 key=form.familyname/ /field field property=email depends=required,email arg0 key=form.email/ /field /form /formset 2) Added the following to my struts-config.xml form-beans form-bean name=surveyForm type=ca.oldring.forms.SurveyForm/ /form-beans global-forwards forward name=survey1_en path=/survey1.jsp?language=en/ forward name=survey1_fr path=/survey1.jsp?language=fr/ /global-forwards action-mappings !-- Process a survey -- actionpath=/survey type=ca.oldring.actions.SurveyAction name=surveyForm scope=request validate=true input=/survey.do forward name=thanks path=/thanks.jsp/ /action /action-mappings 3) Made a bean SurveyForm with generic get and set methods 4) Set up web.xml: servlet servlet-namevalidator/servlet-name servlet-classcom.wintecinc.struts.action.ValidatorServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/validation.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param load-on-startup3/load-on-startup /servlet 5) copied the tld and the Struts_Validator-20010702.jar When I access the survey.do file, the tomcat servlet log gives me this until java segfaults: 2001-09-17 16:53:40 - path=/survey :action: Processing a GET for /survey 2001-09-17 16:53:40 - path=/survey :action: Setting locale 'en' 2001-09-17 16:53:40 - path=/survey :action: Looking for ActionForm bean under attribute 'surveyForm' 2001-09-17 16:53:40 - path=/survey :action: Creating new ActionForm instance of class 'ca.oldring.forms.SurveyForm' 2001-09-17 16:53:40 - path=/survey :action: Storing instance under attribute 'surveyForm' in scope 'request' 2001-09-17 16:53:40 - path=/survey :action: Populating bean properties from this request 2001-09-17 16:53:40 - path=/survey :action: Validating input form properties 2001-09-17 16:53:40 - path=/survey :action: Validation error(s), redirecting to: /survey.do 2001-09-17 16:53:40 - path=/survey :action: Processing a GET for /survey ... Any ideas on why this is looping? It doesn't appear to be reaching my Action class. Thanks, -Mike -- Mike Bridge [EMAIL PROTECTED]
infinite loop
hi all, In continuation to my post yesterday, The following is my code. The flow is fine till Forwarding to Success and then instead of displaying, it starts again from the begining. If i remove the if condition in validate method then it displays the form with errors which is fine. am i doing something wrong thanks, rama. Mappings: !-- FIP User Profile Page bean -- form-bean name="addUser" type="com.niku.cm.action.AddUser"/ !-- FIP User Profile Page -- action path="/adduser" name="addUser" validate="true" input="/adduser.jsp" type="com.niku.cm.action.AddUserAction"forward name="success" path="/adduser.cm"//action adduser.jsp: html:errors / html:form action="/adduser?action=save" focus="fullname"table width="55%" border="0" cellspacing="1" tr td class="fieldname" width="16%"Full Name*/tdtd class="field" width="16%"html:text styleClass="noborder" property="fullname" //td/tr trtd class="fieldname" width="19%"Phone*/tdtd class="field" width="16%"html:text styleClass="noborder" property="phone"/ /td/tr trtd class="fieldname" width="19%"Email*/tdtd class="field" width="16%"html:text styleClass="noborder" property="email"/ /td/tr /table p align=centerhtml:submit /nbsp;nbsp;html:reset //p/html:form AddUser.java (FormBean) private String action="create";private Stringfullname=null;private Stringphone=null;private Stringemail="";privateStringresult="false"; public String getAction() {return (this.action); } public void setAction(String action) { this.action = action; } public String getFullname() {return (this.fullname); } public void setFullname(String _fullname) {this.fullname = _fullname;} public String getPhone() {return (this.phone);} public void setPhone(String _phone) {this.phone=_phone;} public String getEmail() {return (this.email);} public void setEmail(String _email) {this.email=_email;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if((action.equals("create")) ||(action.equals("get"))) return null; ActionErrors errors = new ActionErrors(); if ((fullname == null) || (fullname.length() 1)) errors.add("fullname", new ActionError("error.fullname.required")); if ((phone == null) || (phone.length() 1)) errors.add("phone", new ActionError("error.phone.required")); if ((email == null) || (email.length() 1)) errors.add("email", new ActionError("error.email.required")); return errors; }AddUserAction.java (action class) public final class AddUserAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { file://get the application resourcesMessageResources messages= getResources();file://get the sessionHttpSession session= request.getSession();file://get the actionString action = request.getParameter("action");System.out.println("AddUserAction : Action is "+action);file://if action is null set it to defaultif (action == null) action = "create"; if (servlet.getDebug() = 1) servlet.log("AddUserAction: Processing " + action +" action");file://if form is null then create new instanceif (form == null) { if (servlet.getDebug() = 1) servlet.log(" Creating new AddUserForm bean under key "+ mapping.getAttribute()); form = new AddUser(); if ("request".equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form);} AddUser addform= (AddUser) form;if(action.equals("create")) { /* do nothing */} // Forward control to the server page if (servlet.getDebug() = 1) servlet.log(" Forwarding to success");return (mapping.findForward("success")); } }
Re: infinite loop
What does forward name="success" path="/adduser.cm"/ mean? Shouldn't it be path="/adduser.jsp" ? -- gR - Original Message - From: Rama Krishna To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 8:55 PM Subject: infinite loop hi all, In continuation to my post yesterday, The following is my code. The flow is fine till Forwarding to Success and then instead of displaying, it starts again from the begining. If i remove the if condition in validate method then it displays the form with errors which is fine. am i doing something wrong thanks, rama. Mappings: !-- FIP User Profile Page bean -- form-bean name="addUser" type="com.niku.cm.action.AddUser"/ !-- FIP User Profile Page -- action path="/adduser" name="addUser" validate="true" input="/adduser.jsp" type="com.niku.cm.action.AddUserAction"forward name="success" path="/adduser.cm"//action adduser.jsp: html:errors / html:form action="/adduser?action=save" focus="fullname"table width="55%" border="0" cellspacing="1" tr td class="fieldname" width="16%"Full Name*/tdtd class="field" width="16%"html:text styleClass="noborder" property="fullname" //td/tr trtd class="fieldname" width="19%"Phone*/tdtd class="field" width="16%"html:text styleClass="noborder" property="phone"/ /td/tr trtd class="fieldname" width="19%"Email*/tdtd class="field" width="16%"html:text styleClass="noborder" property="email"/ /td/tr /table p align=centerhtml:submit /nbsp;nbsp;html:reset //p/html:form AddUser.java (FormBean) private String action="create";private Stringfullname=null;private Stringphone=null;private Stringemail="";privateStringresult="false"; public String getAction() {return (this.action); } public void setAction(String action) { this.action = action; } public String getFullname() {return (this.fullname); } public void setFullname(String _fullname) {this.fullname = _fullname;} public String getPhone() {return (this.phone);} public void setPhone(String _phone) {this.phone=_phone;} public String getEmail() {return (this.email);} public void setEmail(String _email) {this.email=_email;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if((action.equals("create")) ||(action.equals("get"))) return null; ActionErrors errors = new ActionErrors(); if ((fullname == null) || (fullname.length() 1)) errors.add("fullname", new ActionError("error.fullname.required")); if ((phone == null) || (phone.length() 1)) errors.add("phone", new ActionError("error.phone.required")); if ((email == null) || (email.length() 1)) errors.add("email", new ActionError("error.email.required")); return errors; }AddUserAction.java (action class) public final class AddUserAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { file://get the application resourcesMessageResources messages= getResources();file://get the sessionHttpSession session= request.getSession();file://get the actionString action = request.getParameter("action");System.out.println("AddUserAction : Action is "+action);file://if action is null set it to defaultif (action == null) action = "create"; if (servlet.getDebug() = 1) servlet.log("AddUserAction: Processing " + action +" action");file://if form is null then create new instanceif (form == null) { if (servlet.getDebug() = 1) servlet.log(" Creating new AddUserForm bean under key "+ mapping.getAttribute()); form = new AddUser(); if ("request".equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form);} AddUser addform= (AddUser) form;if(action.equals("create")) { /* do nothing */} // Forward control to the server page if (servlet.getDebug() = 1) servlet.log(" Forwarding to success");return (mapping.findForward("success")); } }
Re: infinite loop
Are you using extension mapping, with the extension .cm? If so, then your infinite loop is happening because you are forwarding from the action right back to the same action, instead of to the JSP page. Change your forward to reference the JSP instead of the action, like this: forward name=success path=/adduser.jsp/ and things should start working normally. -- Martin Cooper - Original Message - From: Rama Krishna [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 11:55 AM Subject: infinite loop hi all, In continuation to my post yesterday, The following is my code. The flow is fine till Forwarding to Success and then instead of displaying, it starts again from the begining. If i remove the if condition in validate method then it displays the form with errors which is fine. am i doing something wrong thanks, rama. Mappings: !-- FIP User Profile Page bean -- form-bean name=addUser type=com.niku.cm.action.AddUser/ !-- FIP User Profile Page -- actionpath=/adduser name=addUser validate=true input=/adduser.jsp type=com.niku.cm.action.AddUserAction forward name=success path=/adduser.cm/ /action adduser.jsp: html:errors / html:form action=/adduser?action=save focus=fullname table width=55% border=0 cellspacing=1 tr td class=fieldname width=16%Full Name* /td td class=field width=16%html:text styleClass=noborder property=fullname / /td/tr trtd class=fieldname width=19%Phone* /td td class=field width=16%html:text styleClass=noborder property=phone/ /td/tr trtd class=fieldname width=19%Email* /td td class=field width=16%html:text styleClass=noborder property=email/ /td/tr /table p align=centerhtml:submit /nbsp;nbsp;html:reset //p /html:form AddUser.java (FormBean) private String action = create; private String fullname = null; private String phone = null; private String email = ; private String result = false; public String getAction() { return (this.action); } public void setAction(String action) { this.action = action; } public String getFullname() {return (this.fullname); } public void setFullname(String _fullname) {this.fullname = _fullname;} public String getPhone() {return (this.phone);} public void setPhone(String _phone) {this.phone = _phone;} public String getEmail() {return (this.email); } public void setEmail(String _email) {this.email = _email;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if((action.equals(create)) ||(action.equals(get))) return null; ActionErrors errors = new ActionErrors(); if ((fullname == null) || (fullname.length() 1)) errors.add(fullname, new ActionError(error.fullname.required)); if ((phone == null) || (phone.length() 1)) errors.add(phone, new ActionError(error.phone.required)); if ((email == null) || (email.length() 1)) errors.add(email, new ActionError(error.email.required)); return errors; } AddUserAction.java (action class) public final class AddUserAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { file://get file://get the application resources MessageResources messages = getResources(); file://get file://get the session HttpSession session = request.getSession(); file://get file://get the action String action = request.getParameter(action); System.out.println(AddUserAction : Action is +action); file://if file://if action is null set it to default if (action == null) action = create; if (servlet.getDebug() = 1) servlet.log(AddUserAction: Processing + action + action); file://if file://if form is null then create new instance if (form == null) { if (servlet.getDebug() = 1) servlet.log( Creating new AddUserForm bean under key + mapping.getAttribute()); form = new AddUser(); if (request.equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form); } AddUser addform = (AddUser) form; if(action.equals(create)) { /* do nothing */ } // Forward control to the server page if (servlet.getDebug() = 1) servlet.log( Forwarding to success); return (mapping.findForward(success)); } }
Re: infinite loop
:-( i am sorry. you are right. i had few reports with out html:form in them and when i give .cm in forward they work fine. so i was thinking that it would be the same for forms also. thanks much. rama. - Original Message - From: Gregor Rayman To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 11:59 AM Subject: Re: infinite loop What does forward name="success" path="/adduser.cm"/ mean? Shouldn't it be path="/adduser.jsp" ? -- gR - Original Message - From: Rama Krishna To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 8:55 PM Subject: infinite loop hi all, In continuation to my post yesterday, The following is my code. The flow is fine till Forwarding to Success and then instead of displaying, it starts again from the begining. If i remove the if condition in validate method then it displays the form with errors which is fine. am i doing something wrong thanks, rama. Mappings: !-- FIP User Profile Page bean -- form-bean name="addUser" type="com.niku.cm.action.AddUser"/ !-- FIP User Profile Page -- action path="/adduser" name="addUser" validate="true" input="/adduser.jsp" type="com.niku.cm.action.AddUserAction"forward name="success" path="/adduser.cm"//action adduser.jsp: html:errors / html:form action="/adduser?action=save" focus="fullname"table width="55%" border="0" cellspacing="1" tr td class="fieldname" width="16%"Full Name*/tdtd class="field" width="16%"html:text styleClass="noborder" property="fullname" //td/tr trtd class="fieldname" width="19%"Phone*/tdtd class="field" width="16%"html:text styleClass="noborder" property="phone"/ /td/tr trtd class="fieldname" width="19%"Email*/tdtd class="field" width="16%"html:text styleClass="noborder" property="email"/ /td/tr /table p align=centerhtml:submit /nbsp;nbsp;html:reset //p/html:form AddUser.java (FormBean) private String action="create";private Stringfullname=null;private Stringphone=null;private Stringemail="";privateStringresult="false"; public String getAction() {return (this.action); } public void setAction(String action) { this.action = action; } public String getFullname() {return (this.fullname); } public void setFullname(String _fullname) {this.fullname = _fullname;} public String getPhone() {return (this.phone);} public void setPhone(String _phone) {this.phone=_phone;} public String getEmail() {return (this.email);} public void setEmail(String _email) {this.email=_email;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if((action.equals("create")) ||(action.equals("get"))) return null; ActionErrors errors = new ActionErrors(); if ((fullname == null) || (fullname.length() 1)) errors.add("fullname", new ActionError("error.fullname.required")); if ((phone == null) || (phone.length() 1)) errors.add("phone", new ActionError("error.phone.required")); if ((email == null) || (email.length() 1)) errors.add("email", new ActionError("error.email.required")); return errors; }AddUserAction.java (action class) public final class AddUserAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { file://get the application resourcesMessageResources messages= getResources();file://get the sessionHttpSession session= request.getSession();file://get the actionString action = request.getParameter("action");System.out.println("AddUserAction : Action is "+action);file://if action is null set it to defaultif (action == null) action = "create"; if (servlet.getDebug() = 1) servlet.log("AddUserAction: Processing " + action +" action");file://if form is null then create new instanceif
Re: infinite loop
yes, martin. it works fine. i have few .jsp pages without forms means they display reports and they work fine with .cm mapping, so, i was thinking it would be the same for forms also. thanks much, rama. - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 12:07 PM Subject: Re: infinite loop Are you using extension mapping, with the extension .cm? If so, then your infinite loop is happening because you are forwarding from the action right back to the same action, instead of to the JSP page. Change your forward to reference the JSP instead of the action, like this: forward name=success path=/adduser.jsp/ and things should start working normally. -- Martin Cooper - Original Message - From: Rama Krishna [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 04, 2001 11:55 AM Subject: infinite loop hi all, In continuation to my post yesterday, The following is my code. The flow is fine till Forwarding to Success and then instead of displaying, it starts again from the begining. If i remove the if condition in validate method then it displays the form with errors which is fine. am i doing something wrong thanks, rama. Mappings: !-- FIP User Profile Page bean -- form-bean name=addUser type=com.niku.cm.action.AddUser/ !-- FIP User Profile Page -- actionpath=/adduser name=addUser validate=true input=/adduser.jsp type=com.niku.cm.action.AddUserAction forward name=success path=/adduser.cm/ /action adduser.jsp: html:errors / html:form action=/adduser?action=save focus=fullname table width=55% border=0 cellspacing=1 tr td class=fieldname width=16%Full Name* /td td class=field width=16%html:text styleClass=noborder property=fullname / /td/tr trtd class=fieldname width=19%Phone* /td td class=field width=16%html:text styleClass=noborder property=phone/ /td/tr trtd class=fieldname width=19%Email* /td td class=field width=16%html:text styleClass=noborder property=email/ /td/tr /table p align=centerhtml:submit /nbsp;nbsp;html:reset //p /html:form AddUser.java (FormBean) private String action = create; private String fullname = null; private String phone = null; private String email = ; private String result = false; public String getAction() { return (this.action); } public void setAction(String action) { this.action = action; } public String getFullname() {return (this.fullname); } public void setFullname(String _fullname) {this.fullname = _fullname;} public String getPhone() {return (this.phone);} public void setPhone(String _phone) {this.phone = _phone;} public String getEmail() {return (this.email); } public void setEmail(String _email) {this.email = _email;} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { if((action.equals(create)) ||(action.equals(get))) return null; ActionErrors errors = new ActionErrors(); if ((fullname == null) || (fullname.length() 1)) errors.add(fullname, new ActionError(error.fullname.required)); if ((phone == null) || (phone.length() 1)) errors.add(phone, new ActionError(error.phone.required)); if ((email == null) || (email.length() 1)) errors.add(email, new ActionError(error.email.required)); return errors; } AddUserAction.java (action class) public final class AddUserAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { file://get file://get the application resources MessageResources messages = getResources(); file://get file://get the session HttpSession session = request.getSession(); file://get file://get the action String action = request.getParameter(action); System.out.println(AddUserAction : Action is +action); file://if file://if action is null set it to default if (action == null) action = create; if (servlet.getDebug() = 1) servlet.log(AddUserAction: Processing + action + action); file://if file://if form is null then create new instance if (form == null) { if (servlet.getDebug() = 1) servlet.log( Creating new AddUserForm bean under key + mapping.getAttribute()); form = new AddUser(); if (request.equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form); } AddUser addform
infinite loop
hello all, i posted a question regarding the Stackoverflow error. but i got no help. thought i will explain my problem in more detail. i have an adduser.jsp which is invoked thru a href in a normal html page. this adduser.jsp displays a form. there is formbean and actionclass for this adduser.jsp and the mapping is fine. currently, after i am into this problem, the action class does nothing except mapping the form to AddUser and forwarding to adduser.jsp when i invoke this jsp, i get the following error... nulljava.lang.StackOverflowError at allaire.jrun.servlet.ForwardRequest.getParameterNames(../servlet/ForwardRequest.java:206) at allaire.jrun.servlet.ForwardRequest.getParameterNames(../servlet/ForwardRequest.java:206): : this runs for some 100 lines or so and then at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:734) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2050) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1552) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:490) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416) at allaire.jrun.session.JRunSessionService.service(../session/JRunSessionService.java:1082) at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270) at allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDispatcher.java:89) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1747) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1584) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:490): : this runs for another 100 lines or so. i figured that the line in org.apache.struts.util.RequestUtils.java has the following line multipart.setServlet(servlet); multipart.setMapping((ActionMapping) request.getAttribute(Action.MAPPING_KEY)); request.removeAttribute(Action.MAPPING_KEY);**//this is the line i did a system.out for Action.MAPPING_KEY and it is having the correct mapping. if i give a forward to another .jsp page, it works fine. so i thought the error is in my .jsp and removed everything except for html and head tags. nope no use. can anyone help me or point me to a hint. thanks, rama.
Infinite Loop
Hello, I am using Struts 0.5 version (modified to that it can handle default action mappings) and am using Caucho Resin 1.2.1 as the web server. I have defined my Action Servlet Mapping as : !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern/cpf/*/url-pattern /servlet-mapping and my Action Mapping configuration file contains : action-mappings !-- Default User Action-- actionpath="/defaultPath" actionClass="com.hp.cpf.beans.UserRegistrationAction" formAttribute="defaultActionForm" unknown="true" formClass="com.hp.cpf.beans.UserRegistrationForm" forward name="success"path="/cpf/jsps/MainController.jsp"/ /action /action-mappings When I send a HTTP request, the ActionServlet forwards that to "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the forwarded URL starts with "cpf", it is again redirected to the ActionServlet which in turn forwards it to the "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too Many Servlets" exception. Any pointers on how to work around this problem. Thanks in advance, Swapnil.
Infinite Loop
Hello, I am using Struts 0.5 version (modified to that it can handle default action mappings) and am using Caucho Resin 1.2.1 as the web server. I have defined my Action Servlet Mapping as : !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern/cpf/*/url-pattern /servlet-mapping and my Action Mapping configuration file contains : action-mappings !-- Default User Action-- actionpath="/defaultPath" actionClass="com.hp.cpf.beans.UserRegistrationAction" formAttribute="defaultActionForm" unknown="true" formClass="com.hp.cpf.beans.UserRegistrationForm" forward name="success"path="/cpf/jsps/MainController.jsp"/ /action /action-mappings When I send a HTTP request, the ActionServlet forwards that to "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the forwarded URL starts with "cpf", it is again redirected to the ActionServlet which in turn forwards it to the "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too Many Servlets" exception. Any pointers on how to work around this problem. Thanks in advance, Swapnil.
Re: Infinite Loop
swapnil ghiware wrote: Hello, I am using Struts 0.5 version (modified to that it can handle default action mappings) and am using Caucho Resin 1.2.1 as the web server. I have defined my Action Servlet Mapping as : !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern/cpf/*/url-pattern /servlet-mapping and my Action Mapping configuration file contains : action-mappings !-- Default User Action-- actionpath="/defaultPath" actionClass="com.hp.cpf.beans.UserRegistrationAction" formAttribute="defaultActionForm" unknown="true" formClass="com.hp.cpf.beans.UserRegistrationForm" forward name="success"path="/cpf/jsps/MainController.jsp"/ /action /action-mappings When I send a HTTP request, the ActionServlet forwards that to "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the forwarded URL starts with "cpf", it is again redirected to the ActionServlet which in turn forwards it to the "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too Many Servlets" exception. Any pointers on how to work around this problem. Can't you make sure that your JSP page paths do not start with "/cpf"? In other words, you might arrange your web app files like this: WEB-INF/ web.xml struts-config.xml jsps/ ... *.jsp files ... and the path entry would be "/jsps/MainController.jsp" instead of "/cpf/jsps/MainController.jsp". Thanks in advance, Swapnil. Craig McClanahan
Re: Infinite Loop
That's a possibility. But there is a bunch of code and existing directory structure which i would rather not modify unless I have no other option. Thanks, Swapnil. - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 10, 2001 12:50 PM Subject: Re: Infinite Loop swapnil ghiware wrote: Hello, I am using Struts 0.5 version (modified to that it can handle default action mappings) and am using Caucho Resin 1.2.1 as the web server. I have defined my Action Servlet Mapping as : !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern/cpf/*/url-pattern /servlet-mapping and my Action Mapping configuration file contains : action-mappings !-- Default User Action-- actionpath="/defaultPath" actionClass="com.hp.cpf.beans.UserRegistrationAction" formAttribute="defaultActionForm" unknown="true" formClass="com.hp.cpf.beans.UserRegistrationForm" forward name="success"path="/cpf/jsps/MainController.jsp"/ /action /action-mappings When I send a HTTP request, the ActionServlet forwards that to "/cpf/jsps/MainController.jsp" (as defined by the "forward" tag). Since, the forwarded URL starts with "cpf", it is again redirected to the ActionServlet which in turn forwards it to the "/cpf/jsps/MainController.jsp". This keeps on looping until I hit a "Too Many Servlets" exception. Any pointers on how to work around this problem. Can't you make sure that your JSP page paths do not start with "/cpf"? In other words, you might arrange your web app files like this: WEB-INF/ web.xml struts-config.xml jsps/ ... *.jsp files ... and the path entry would be "/jsps/MainController.jsp" instead of "/cpf/jsps/MainController.jsp". Thanks in advance, Swapnil. Craig McClanahan