My .jsp does not call the ActionForm servlet :-(

M

milkyway

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.
 
R

Ryan Stewart

milkyway said:
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?
 
M

milkyway

Hello 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.
 
R

Robert kebernet Cooper

milkyway said:
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.
 
M

milkyway

Thank 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.
 
R

Robert kebernet Cooper

Im 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top