RE: action mapping question
1) why would you need a logoff form? 2) what version of struts are you using? You don't have to have a form bean declare for an action mapping. The reason it throw the exception Because you have the input attribute setting. With this setting the controller makes assumsion that your mapping has a from bean associate to it and make call to the validate methods. I guess the solution is not to provide from bean mapping and input mapping for your action. danny -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 8:17 AM To: [EMAIL PROTECTED] Subject: action mapping question Hi, Having a few problems getting my application working properly. Basically I've got a logon.jsp page which posts to logon.do action, which then validates and if successfull outputs search.jsp (shows in the browser as /logon.do ). then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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: action mapping question
1) I dont need a logoff form, but if i dont have one then i get errors of type: form bean null. 2) 1.0 Trieu, Danny wrote: 1) why would you need a logoff form? 2) what version of struts are you using? You don't have to have a form bean declare for an action mapping. The reason it throw the exception Because you have the input attribute setting. With this setting the controller makes assumsion that your mapping has a from bean associate to it and make call to the validate methods. I guess the solution is not to provide from bean mapping and input mapping for your action. danny -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 8:17 AM To: [EMAIL PROTECTED] Subject: action mapping question Hi, Having a few problems getting my application working properly. Basically I've got a logon.jsp page which posts to logon.do action, which then validates and if successfull outputs search.jsp (shows in the browser as /logon.do ). then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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: action mapping question
this error to be exact javax.servlet.ServletException: Cannot retrieve definition for form bean null Trieu, Danny wrote: 1) why would you need a logoff form? 2) what version of struts are you using? You don't have to have a form bean declare for an action mapping. The reason it throw the exception Because you have the input attribute setting. With this setting the controller makes assumsion that your mapping has a from bean associate to it and make call to the validate methods. I guess the solution is not to provide from bean mapping and input mapping for your action. danny -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 8:17 AM To: [EMAIL PROTECTED] Subject: action mapping question Hi, Having a few problems getting my application working properly. Basically I've got a logon.jsp page which posts to logon.do action, which then validates and if successfull outputs search.jsp (shows in the browser as /logon.do ). then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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: action mapping question
Hmm This sound like it is the way 1.0 of struts was implemented. I haven't use 1.0 for quite sometime so I don't remember. But, there is something you can do. You can set the attribute validate=false, so that the controller don't have to call the validate method on your from bean. You Don't have to implement the validate method on your from bean, but if you do return null or empty actionErrors. As for input, I don't think you need to provide one. Sorry if I didn't help you in anyway:) Danny Ps. Move to 1.1 -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 9:24 AM To: Struts Users Mailing List Subject: Re: action mapping question 1) I dont need a logoff form, but if i dont have one then i get errors of type: form bean null. 2) 1.0 Trieu, Danny wrote: 1) why would you need a logoff form? 2) what version of struts are you using? You don't have to have a form bean declare for an action mapping. The reason it throw the exception Because you have the input attribute setting. With this setting the controller makes assumsion that your mapping has a from bean associate to it and make call to the validate methods. I guess the solution is not to provide from bean mapping and input mapping for your action. danny -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 8:17 AM To: [EMAIL PROTECTED] Subject: action mapping question Hi, Having a few problems getting my application working properly. Basically I've got a logon.jsp page which posts to logon.do action, which then validates and if successfull outputs search.jsp (shows in the browser as /logon.do ). then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: action mapping question
You shouldn't have to have a form bean. Here's the global forward I use for the logout action: forward name=forward.logout path=/exec/logout/ Here's my action mapping for my logout action (Struts 1.0.2, with Tiles): action path=/logout type=com.sprintpcs.ptt.controller.authentication.LogoutAction forward name=forward.success path=template.login/ /action The action class is short n' sweet (my abstract ActionSupport class overrides Action's perform() method and then calls the abstract execute() method): public class LogoutAction extends ActionSupport { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); if (session != null) { session.removeAttribute(USER_OBJECT_SESSION_ATTRIBUTE_KEY); session.invalidate(); } return mapping.findForward(SUCCESS); } } So, then, all you need to do to let the user logout is provide a simple link like this: html:link forward=forward.logoutbean:message key=key.logout//html:link That should do it! Hope this helps, chris -Original Message- From: Darren McGuinness [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: action mapping question Hi, Having a few problems getting my application working properly. Basically I've got a logon.jsp page which posts to logon.do action, which then validates and if successfull outputs search.jsp (shows in the browser as /logon.do ). then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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: action mapping question
The html:form tag expects there to be a ActionForm bean associated with the form. If you are using a button-only form, you still need to provide an ActionForm bean, even if it is an empty implementation. I generally keep one of these in my Struts toolkit to use throughout an application. Or, you could just use whatever bean is handy. You don't need a bean with an Action, but you do need one to appease the html:form tag. -Ted. then on search.jsp i have 2 forms, one to search.do and one to logoff.do here's my action mapping for logoff: action path=/logoff type=struts1.action.LogoffAction name=logoffForm input=/logon.do scope=request forward name=success path=/logon.jsp/ forward name=failure path=/logon.jsp/ /action first of all, i dont want to use a bean for the logoff action but it complains otherwise, so for now i've used a form with a attribute dummy with get/set/reset/validate methodsis there a way not to have to do this? if i dont have a form, I get an exception complaining the form bean is null. second, what should 'input' be? if i leave it as /logon.do then it works, but also if i put it as /tapssearch.jsp it works..so what should it be? and how can i set action-mapping to accept input from any page, seeing as for example i'll want to be able to log-off from any one of the pages(bar the logon one of course!) So that i dont have to write an action mapping for every page that has a logoff form cheers -- 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]