Action without ActionForm
Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without ActionForm
If there is no ActionForm html:form doesn't work. Try with normal form tag it works fine. Hope this helps. Srini [EMAIL PROTECTED] 02/04/04 07:00PM Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - 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: Action without ActionForm
You can also declare a dummy form. struts-config form-beans form-bean name=currentTimeForm type=org.apache.struts.action.DynaActionForm / /form-beans action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction name=currentTimeForm forward name=success path=/CurrentTime.jsp / /action /action-mappings ... - Hubert --- Srinivas Kusunam [EMAIL PROTECTED] wrote: If there is no ActionForm html:form doesn't work. Try with normal form tag it works fine. Hope this helps. Srini [EMAIL PROTECTED] 02/04/04 07:00PM Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - 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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without ActionForm
Thanks , Both work fine. but Using-normal-form way needs a little change of the action attribute URL of form tag inJSP. I had to change from html:form action=/currenttime to form action=testAPP/currenttime.do testAPP is root of this webapp So, I choose the Using-dummy-actionform way for resemblance with other JSPs. Thank you again. At 17:18 04/02/04 -0800, you wrote: You can also declare a dummy form. - Hubert --- Srinivas Kusunam [EMAIL PROTECTED] wrote: If there is no ActionForm html:form doesn't work. Try with normal form tag it works fine. Srini [EMAIL PROTECTED] 02/04/04 07:00PM Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without ActionForm
My perspective is that there is still value in having an ActionForm for that example. I generally think it is best for your Actions to pass information to the JSPs that render them through an ActionForm rather than putting things in the request or session directly. For this reason, I think it would be better to put the current time into an ActionForm than to stuff it into the session. Struts will put your ActionForm in the request or session for you; your Action need only populate it with data, and then the JSP can expect to find your well-defined ActionForm in the scope specified in the struts-config.xml file. It doesn't matter if there is no data coming in on the request for Struts to pre-populate the ActionForm. Using an ActionForm still has value in that it defines what the JSP can expect to find, and where. Opinions on this topic surely vary (i.e. I am sure some people will disagree with my recommendation here), and I have seen a lot of Actions and JSPs that communicate via request and session attributes that aren't defined in the struts-config file. But I prefer to limit the communication between the Action and the JSP to a well-defined ActionForm in a well-defined scope to the extent that it is possible. I view the Action/JSP coupling that comes with passing otherwise undefined request and session attributes to be undesireable. I think it is better to keep the interface between these components (a specific ActionForm in a specific scope) well defined (by specifying it in the struts-config.xml file). -Max - Original Message - From: Masashi Nakane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 5:00 PM Subject: Action without ActionForm Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - 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: Action without ActionForm
My two cents worth is that I am with Max on this one. I have discovered that when I use patterned solutions I get benefits I did not think of at the time. This is particularly true of the HTTP version of the MVC framework. At 09:35 PM 2/4/2004, you wrote: My perspective is that there is still value in having an ActionForm for that example. I generally think it is best for your Actions to pass information to the JSPs that render them through an ActionForm rather than putting things in the request or session directly. For this reason, I think it would be better to put the current time into an ActionForm than to stuff it into the session. Struts will put your ActionForm in the request or session for you; your Action need only populate it with data, and then the JSP can expect to find your well-defined ActionForm in the scope specified in the struts-config.xml file. It doesn't matter if there is no data coming in on the request for Struts to pre-populate the ActionForm. Using an ActionForm still has value in that it defines what the JSP can expect to find, and where. Opinions on this topic surely vary (i.e. I am sure some people will disagree with my recommendation here), and I have seen a lot of Actions and JSPs that communicate via request and session attributes that aren't defined in the struts-config file. But I prefer to limit the communication between the Action and the JSP to a well-defined ActionForm in a well-defined scope to the extent that it is possible. I view the Action/JSP coupling that comes with passing otherwise undefined request and session attributes to be undesireable. I think it is better to keep the interface between these components (a specific ActionForm in a specific scope) well defined (by specifying it in the struts-config.xml file). -Max - Original Message - From: Masashi Nakane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 5:00 PM Subject: Action without ActionForm Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action without ActionForm
+1 I too am finding that it is quite convienient to treat the actionform as the pages UI State rather than merely an input buffer. -Original Message- From: Michael McGrady [mailto:[EMAIL PROTECTED] Sent: Thursday, 5 February 2004 13:42 To: Struts Users Mailing List Subject: Re: Action without ActionForm My two cents worth is that I am with Max on this one. I have discovered that when I use patterned solutions I get benefits I did not think of at the time. This is particularly true of the HTTP version of the MVC framework. At 09:35 PM 2/4/2004, you wrote: My perspective is that there is still value in having an ActionForm for that example. I generally think it is best for your Actions to pass information to the JSPs that render them through an ActionForm rather than putting things in the request or session directly. For this reason, I think it would be better to put the current time into an ActionForm than to stuff it into the session. Struts will put your ActionForm in the request or session for you; your Action need only populate it with data, and then the JSP can expect to find your well-defined ActionForm in the scope specified in the struts-config.xml file. It doesn't matter if there is no data coming in on the request for Struts to pre-populate the ActionForm. Using an ActionForm still has value in that it defines what the JSP can expect to find, and where. Opinions on this topic surely vary (i.e. I am sure some people will disagree with my recommendation here), and I have seen a lot of Actions and JSPs that communicate via request and session attributes that aren't defined in the struts-config file. But I prefer to limit the communication between the Action and the JSP to a well-defined ActionForm in a well-defined scope to the extent that it is possible. I view the Action/JSP coupling that comes with passing otherwise undefined request and session attributes to be undesireable. I think it is better to keep the interface between these components (a specific ActionForm in a specific scope) well defined (by specifying it in the struts-config.xml file). -Max - Original Message - From: Masashi Nakane [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 5:00 PM Subject: Action without ActionForm Hi ,all I am new to Struts and learning it. And I am wondering how the strtus-config.xml and JSP look like when a JSP doesn't submit any info( dont need ActionForm) . The JSP just display the current time and has one button refresh. CurrentTime.jsp ( user push refresh button) - CurrentTimeAction(get current time and put it to Session Attribute) - CurrentTime.jsp ( get time from Session and render) I have made the JSP without Struts framework . it works . but I have no idea how I can make this with action mapping in struts-config.xml. I made the mapping below and I got error when I try to open the JSP . JSP is using html:form tag to make form. javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null but i dont need any ActionForm - action-mappings action path=/currenttime type=com.somecompany.CurrentTimeAction forward name=success path=/CurrentTime.jsp / /action /action-mappings - I have already checked the which attribute of action tag is mandatory or optional . Should I make dummy ActionForm ? Any comments are appriciated. Masashi Nakane - 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] - 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]