Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I have a .jsp that when opening, I feel should call the ActionForm (holding "getters" and "setters"). But this is not going on. Is there some place I can look to see what the problem is? What exactly is one supposed to do so that when running a .jsp file, the class (based on the ActionForm) will be called? Kindest Regards.
Post Follow-up to this message"milkyway" <d0mufasa@hotmail.com> wrote in message news:1103978114.152877.122360@f14g2000cwb.googlegroups.com... > Hello, > > I have a .jsp that when opening, I feel should call the ActionForm > (holding "getters" and "setters"). But this is not going on. Is there > some place I can look to see what the problem is? > > What exactly is one supposed to do so that when running a .jsp file, > the class (based on the ActionForm) will be called? > What are you doing that you expect your JSP to "call" the ActionForm? When you use the html:form tag (you are, right?), Struts looks at the action attribute of the tag, matches it up to an action mapping in your struts-config, and checks that mapping for a name attribute, which tells it what form to use. If found, it will instantiate that ActionForm or reuse an existing one. Does that answer your question?
Post Follow-up to this messageHello and thank you for responding :-) It was my understanding that when opening a .jsp file, the class that extends ActionForm would automatically be called (to do the getters and setters). In my case, I would like a "getter" to put some data in the .jsp for display to the user. I thought that the class that extends the Action servlet would be used to guide the processing to the next step (for example another .jsp page). Thank you for the explanation on the action form. I suppose that I did not define the mapping in the struts-config. One question though: Does one ~have~ to use the "html:form" tag or tags in general when using struts or can some just use the regular HTML tags <html> </html> A second question: with the action attribute, I have seen something like general.do - what is the .do for? Kindest Regards.
Post Follow-up to this messagemilkyway wrote: > Thank you for the explanation on the action form. I suppose that I did > not define the mapping in the struts-config. One question though: Does > one ~have~ to use the "html:form" tag or tags in general when using > struts or can some just use the regular HTML tags <html> </html> > Remember "html:" is the namespace. You use the <html:form> tag as a replacement for <form> not <html> (that would be <html:html>. And yes, you have to use the struts tag to get the autopopulation of the <form> tag.
Post Follow-up to this messageThank you again for writing back . But - what does the action with a ".do" do - sorry if it is common knowledge. Or - if you could point me to documentation (easy to understand) that says what it does that would be great Kindest Regards.
Post Follow-up to this messageIm sure if you go to OnJava or there are some newbie struts stuff. Basically you are looking at this: You build an action handler java class. You put the action and form bean defs in the struts xml file and you use the struts <html:form> tag and <html:input whatever> stuff in you JSP and it will automatically fill out the method signatures and pre populate the forms.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.