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

Discussion in 'Java' started by milkyway, Dec 25, 2004.

  1. milkyway

    milkyway Guest

    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.
    milkyway, Dec 25, 2004
    #1
    1. Advertising

  2. milkyway

    Ryan Stewart Guest

    "milkyway" <> wrote in message
    news:...
    > 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?
    Ryan Stewart, Dec 25, 2004
    #2
    1. Advertising

  3. milkyway

    milkyway Guest

    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.
    milkyway, Dec 25, 2004
    #3
  4. milkyway 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.
    Robert kebernet Cooper, Dec 25, 2004
    #4
  5. milkyway

    milkyway Guest

    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.
    milkyway, Dec 25, 2004
    #5
  6. 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.
    Robert kebernet Cooper, Dec 25, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. circuit_breaker
    Replies:
    2
    Views:
    1,984
    Jack Jia
    Apr 4, 2004
  2. milkyway
    Replies:
    0
    Views:
    323
    milkyway
    Dec 25, 2004
  3. Replies:
    0
    Views:
    406
  4. Replies:
    4
    Views:
    13,232
    Simon Brooke
    Nov 11, 2006
  5. Agent86
    Replies:
    6
    Views:
    2,864
    Tim Slattery
    Oct 24, 2008
Loading...

Share This Page