Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • mailreader question

    6 answers - 1149 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hello,
    i am currently working on my first struts application. That is why i am
    looking at the example and there are a few things i do not understand.
    The tour says something about an action-mapping
    <action path="/EditRegistration"
    indeed there is nothing like this in the struts-config.xml
    How does struts know which Action to execute? It could know that from
    the name because there is an EditRegsitrationAction.class but how does
    it know which jsp to use? There is a Regsitration.jsp which handles
    EditRegsitration.do but i don't see a action-mapping for that. I also
    don't see any form-bean definitions for the whole Registration stuff.
    Are there naming conventions which handle all that? And if they exist
    where do i find documentation about that.
    I read the UserGuide but that does not tell about naming cenvetions for
    form-beans or action-mappings.
    I hope you can answer my questions.
    Henning
    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.1 | | 2591 bytes | |

    Fri, 2006-07-28 at 19:58 +0200, Henning Schild wrote:
    Hello,

    i am currently working on my first struts application. That is why i am
    looking at the example and there are a few things i do not understand.

    The tour says something about an action-mapping

    <action path="/EditRegistration"

    indeed there is nothing like this in the struts-config.xml

    How does struts know which Action to execute? It could know that from
    the name because there is an EditRegsitrationAction.class but how does
    it know which jsp to use? There is a Regsitration.jsp which handles
    EditRegsitration.do but i don't see a action-mapping for that. I also
    don't see any form-bean definitions for the whole Registration stuff.
    Are there naming conventions which handle all that? And if they exist
    where do i find documentation about that.
    I read the UserGuide but that does not tell about naming cenvetions for
    form-beans or action-mappings.

    I hope you can answer my questions.

    Henning

    Henning,

    >From the Tour:


    If you check the struts-config.xml, you'll see that the
    editRegistration action is mapped to the (surprise again!), the
    EditRegistrationAction; it uses a registrationForm bean, and
    registration.jsp for input.

    <!-- Registration form bean
    <form-bean name="registrationForm"
    type=""/>

    <!-- Edit user registration
    <action path="/editRegistration"
    type=""
    name="registrationForm"
    scope="request"
    validate="false"
    input="/registration.jsp">
    <forward name="success" path="/registration.jsp"/>
    </action>

    The fact that the path, type, and forward values are similar is simply a
    convention that makes it easier to understand without memorizing the
    struts-config file.

    The /editRegistration.do URL is mapped to the EditRegistrationAction
    class in the <actiontag shown. It's tied to the form-bean above
    through the name attribute of the <actiontag.

    The Action forwards to the JSP view via a call at the end of its execute
    method:

    return mapping.findForward( "success" );

    And as you see there is a local forward for this action keyed on
    "success" to "/registration.jsp". If it was absent, there would need to
    be a global forward for it.

    I hope this helps.

    I'm a Struts newbie myself, hoping to improve my understanding through
    helping others (and being corrected unmercifully).

    Chris
  • No.2 | | 1841 bytes | |

    Fri, 28 Jul 2006 11:26:57 -0700
    Christopher Goldman <cgoldman (AT) dhapdigital (DOT) comwrote:

    <!-- Registration form bean
    <form-bean name="registrationForm"
    type=""/>

    <!-- Edit user registration
    <action path="/editRegistration"
    type=""
    name="registrationForm"
    scope="request"
    validate="false"
    input="/registration.jsp">
    <forward name="success" path="/registration.jsp"/>
    </action>

    This is not included in my binary version struts-1.2.9. And the md5sum
    for the zip file ist correct.

    The fact that the path, type, and forward values are similar is
    simply a convention that makes it easier to understand without
    memorizing the struts-config file.

    The /editRegistration.do URL is mapped to the EditRegistrationAction
    class in the <actiontag shown. It's tied to the form-bean above
    through the name attribute of the <actiontag.

    The Action forwards to the JSP view via a call at the end of its
    execute method:

    return mapping.findForward( "success" );

    And as you see there is a local forward for this action keyed on
    "success" to "/registration.jsp". If it was absent, there would need
    to be a global forward for it.

    If all the things you described where in the .war files
    struts-config.xml i would not have asked, because i read how it works
    in theory.

    I now had a look at 1.2.9-src und 1.2.8-bin, the struts-config.xml does
    not have these entries.
    I mean
    So i did what the tour says. I had a look at the file and did not only
    look at what the tour says the file should contain.

    Henning

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.3 | | 844 bytes | |

    Fri, 2006-07-28 at 20:57 +0200, Henning Schild wrote:
    This is not included in my binary version struts-1.2.9. And the md5sum
    for the zip file ist correct.

    [snipped]

    If all the things you described where in the .war files
    struts-config.xml i would not have asked, because i read how it works
    in theory.

    I now had a look at 1.2.9-src und 1.2.8-bin, the struts-config.xml does
    not have these entries.
    I mean
    So i did what the tour says. I had a look at the file and did not only
    look at what the tour says the file should contain.

    Ah, well, I didn't know what "tour" you were looking at.

    So I googled for "struts tour editregistration" and found this as the
    first hit:

    That's where I got the bits of the struts-config.xml file I quoted.

    Good luck!

    Chris
  • No.4 | | 688 bytes | |

    Fri, 28 Jul 2006 13:46:33 -0700
    Christopher Goldman <cgoldman (AT) dhapdigital (DOT) comwrote:

    Ah, well, I didn't know what "tour" you were looking at.

    So I googled for "struts tour editregistration" and found this as the
    first hit:

    That's where I got the bits of the struts-config.xml file I quoted.

    Found the definitions in It is done
    with wildcards and that is why grep did not find it. But the tour
    describes something else, maybe it should be updated.

    Henning

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.5 | | 1525 bytes | |

    7/28/06, Christopher Goldman <cgoldman (AT) dhapdigital (DOT) comwrote:
    Fri, 2006-07-28 at 19:58 +0200, Henning Schild wrote:
    Hello,

    i am currently working on my first struts application. That is why i am
    looking at the example and there are a few things i do not understand.

    The tour says something about an action-mapping

    <action path="/EditRegistration"

    indeed there is nothing like this in the struts-config.xml

    To make life more interesting, the MailReader 1.2.9 uses multiple
    configuration files and wildcard mappings. The mapping that matches
    the URI "/EditRegistration.do" is in the
    struts-config-registration.xml file.

    *

    Since there is not an exact or closer match, the mapping it does match is

    <!-- Matches all edit actions (in this case, only user regstration)
    <action path="/Edit*"
    type="{1}Action"
    name="{1}Form"
    scope="request"
    validate="false">
    <forward name="success" path="/{1}.jsp"/>
    </action>

    which in turn resolves to the EditRegistrationAction and the
    RegistrationForm. (The {1} is matched to the value of the first *).

    The tour for MailReader 1.3 (and 2.0) has been updated to explain
    wildcards and to demonstrate best practices.

    *
    -- HTH, Ted.
    * http://www.husted.com/struts/

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.6 | | 949 bytes | |

    Sun, 30 Jul 2006 07:47:32 -0400
    "Ted Husted" <husted (AT) apache (DOT) orgwrote:

    To make life more interesting, the MailReader 1.2.9 uses multiple
    configuration files and wildcard mappings. The mapping that matches
    the URI "/EditRegistration.do" is in the
    struts-config-registration.xml file.

    I found that on my own after a long while. And I do understand how the
    wildcards work, since this is explained in the userguide.

    The tour for MailReader 1.3 (and 2.0) has been updated to explain
    wildcards and to demonstrate best practices.

    *

    The problem is that there are struts releases which include the new
    Mailreader and the old Tour. As far as i checked 1.2.(8|9), maybe
    earlier versions have that problem too.

    Henning

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org

Re: mailreader question


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Java"

EMSDN.COM