You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julien Martin <ju...@wanadoo.fr> on 2003/10/15 18:10:33 UTC

[REPOST] basic question about global forward

Hello,

I am going through the struts sample application (struts-example.war) and I
am trying to understand the firtst global forward.  Here it is:

***********************************
    <forward   name="logoff"               path="/logoff.do"/>
***********************************

How does the application knows that "logoff.do" is mapped to the logon.jsp
page?

Can anyone help please?

Thanks in advance,

Julien.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [REPOST] basic question about global forward

Posted by Barry Volpe <st...@childrencare.com>.
Julien,

What I see is that the /logoff is fowarded to the index.jsp.
not the logon.jsp.  I'm guessing that you have disabled the
foward and expect the index.jsp to not be displayed?

I'm not saying that this will solve your problem but once
in awhile you might want to clear out your browser cache.
You could be displaying a page from cache that no longer exists.

Also if you are running tomcat you must stop and restart
tomcat so the new changes in your struts-config become
available to your application.

Barry





<!-- Process a user logoff -->
    <action    path="/logoff"
               type="org.apache.struts.webapp.example.LogoffAction">
      <!--forward name="success"              path="/index.jsp"/--><!--
DISABLED -->
    </action>





----- Original Message ----- 
From: "Julien Martin" <ju...@wanadoo.fr>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, October 15, 2003 9:36 AM
Subject: [REPOST] basic question about global forward


> Hello,
> Thank you for your reply Barry.   Note that I have disabled the local
> forward.  I don't understand how the application knows that "logoff.do" is
> mapped to the "logon.jsp".  Can you tell me?
> Julien.
>
> Here is the struts-config.xml file:
> ************************
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration
1.1//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>
> <!--
>      This is the Struts configuration file for the example application,
>      using the proposed new syntax.
> -->
>
>
> <struts-config>
>
>
> <!-- ========== Data Source Configuration
> =============================== -->
> <!--
>  <data-sources>
>    <data-source>
>      <set-property property="autoCommit"
>                       value="false"/>
>      <set-property property="description"
>                       value="Example Data Source Configuration"/>
>      <set-property property="driverClass"
>                       value="org.postgresql.Driver"/>
>      <set-property property="maxCount"
>                       value="4"/>
>      <set-property property="minCount"
>                       value="2"/>
>      <set-property property="password"
>                       value="mypassword"/>
>      <set-property property="url"
>                       value="jdbc:postgresql://localhost/mydatabase"/>
>      <set-property property="user"
>                       value="myusername"/>
>    </data-source>
>  </data-sources>
> -->
>   <!-- ========== Form Bean Definitions
> =================================== -->
>   <form-beans>
>
>     <!-- Logon form bean -->
>     <form-bean       name="logonForm"
>                      type="org.apache.struts.validator.DynaValidatorForm">
>       <form-property name="username" type="java.lang.String"/>
>       <form-property name="password" type="java.lang.String"/>
>     </form-bean>
>
>
>     <!-- Registration form bean -->
>     <form-bean      name="registrationForm"
>
> type="org.apache.struts.webapp.example.RegistrationForm"/>
>
>     <!-- Subscription form bean -->
>     <form-bean      name="subscriptionForm"
>
> type="org.apache.struts.webapp.example.SubscriptionForm"/>
>
>   </form-beans>
>
>
>   <!-- ========== Global Forward Definitions
> ============================== -->
>   <global-forwards>
>     <forward   name="logoff"               path="/logoff.do"/><!--
> HERE!! -->
>     <forward   name="logon"                path="/logon.jsp"/>
>     <forward   name="registration"         path="/registration.jsp"/>
>     <forward   name="success"              path="/mainMenu.jsp"/>
>   </global-forwards>
>
>
>   <!-- ========== Action Mapping Definitions
> ============================== -->
>   <action-mappings>
>
>     <!-- Edit user registration -->
>     <action    path="/editRegistration"
>
> type="org.apache.struts.webapp.example.EditRegistrationAction"
>           attribute="registrationForm"
>               scope="request"
>            validate="false">
>       <forward name="success"              path="/registration.jsp"/>
>     </action>
>
>     <!-- Edit mail subscription -->
>     <action    path="/editSubscription"
>
> type="org.apache.struts.webapp.example.EditSubscriptionAction"
>           attribute="subscriptionForm"
>               scope="request"
>            validate="false">
>       <forward name="failure"              path="/mainMenu.jsp"/>
>       <forward name="success"              path="/subscription.jsp"/>
>     </action>
>
>     <!-- Process a user logoff -->
>     <action    path="/logoff"
>                type="org.apache.struts.webapp.example.LogoffAction">
>       <!--forward name="success"              path="/index.jsp"/--><!--
> DISABLED -->
>     </action>
>
>     <!-- Process a user logon -->
>     <action    path="/logon"
>                type="org.apache.struts.webapp.example.LogonAction"
>                name="logonForm"
>               scope="session"
>               input="logon">
>       <exception
>                 key="expired.password"
>
> type="org.apache.struts.webapp.example.ExpiredPasswordException"
>                path="/changePassword.jsp"/>
>     </action>
>
>     <!-- Save user registration -->
>     <action    path="/saveRegistration"
>
> type="org.apache.struts.webapp.example.SaveRegistrationAction"
>                name="registrationForm"
>               scope="request"
>               input="registration"/>
>
>     <!-- Save mail subscription -->
>     <action    path="/saveSubscription"
>
> type="org.apache.struts.webapp.example.SaveSubscriptionAction"
>                name="subscriptionForm"
>               scope="request"
>               input="subscription">
>       <forward name="subscription"    path="/subscription.jsp"/>
>       <forward name="success"
> path="/editRegistration.do?action=Edit"/>
>     </action>
>
>
>     <!-- Display the "walking tour" documentation -->
>     <action    path="/tour"
>             forward="/tour.htm">
>     </action>
>
>   </action-mappings>
>
>
>   <!-- ========== Controller Configuration
> ================================ -->
>
>   <controller>
>     <!-- The "input" parameter on "action" elements is the name of a
>          local or global "forward" rather than a module-relative path -->
>     <set-property property="inputForward" value="true"/>
>   </controller>
>
>
>   <!-- ========== Message Resources Definitions
> =========================== -->
>
>   <message-resources
>     parameter="org.apache.struts.webapp.example.ApplicationResources"/>
>
>   <message-resources
>
> parameter="org.apache.struts.webapp.example.AlternateApplicationResources"
>     key="alternate">
>   </message-resources>
>
>
>   <!-- ========== Plug Ins Configuration
> ================================== -->
>
>   <plug-in className="org.apache.struts.plugins.ModuleConfigVerifier"/>
>
>   <plug-in
> className="org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn">
>     <set-property property="pathname" value="/WEB-INF/database.xml"/>
>   </plug-in>
>
>   <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>     <set-property property="pathnames"
>                      value="/WEB-INF/validator-rules.xml,
>                             /WEB-INF/validation.xml"/>
>   </plug-in>
>
>
> </struts-config>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


[REPOST] basic question about global forward

Posted by Julien Martin <ju...@wanadoo.fr>.
Hello,
Thank you for your reply Barry.   Note that I have disabled the local
forward.  I don't understand how the application knows that "logoff.do" is
mapped to the "logon.jsp".  Can you tell me?
Julien.

Here is the struts-config.xml file:
************************
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<!--
     This is the Struts configuration file for the example application,
     using the proposed new syntax.
-->


<struts-config>


<!-- ========== Data Source Configuration
=============================== -->
<!--
 <data-sources>
   <data-source>
     <set-property property="autoCommit"
                      value="false"/>
     <set-property property="description"
                      value="Example Data Source Configuration"/>
     <set-property property="driverClass"
                      value="org.postgresql.Driver"/>
     <set-property property="maxCount"
                      value="4"/>
     <set-property property="minCount"
                      value="2"/>
     <set-property property="password"
                      value="mypassword"/>
     <set-property property="url"
                      value="jdbc:postgresql://localhost/mydatabase"/>
     <set-property property="user"
                      value="myusername"/>
   </data-source>
 </data-sources>
-->
  <!-- ========== Form Bean Definitions
=================================== -->
  <form-beans>

    <!-- Logon form bean -->
    <form-bean       name="logonForm"
                     type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="username" type="java.lang.String"/>
      <form-property name="password" type="java.lang.String"/>
    </form-bean>


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

type="org.apache.struts.webapp.example.RegistrationForm"/>

    <!-- Subscription form bean -->
    <form-bean      name="subscriptionForm"

type="org.apache.struts.webapp.example.SubscriptionForm"/>

  </form-beans>


  <!-- ========== Global Forward Definitions
============================== -->
  <global-forwards>
    <forward   name="logoff"               path="/logoff.do"/><!--
HERE!! -->
    <forward   name="logon"                path="/logon.jsp"/>
    <forward   name="registration"         path="/registration.jsp"/>
    <forward   name="success"              path="/mainMenu.jsp"/>
  </global-forwards>


  <!-- ========== Action Mapping Definitions
============================== -->
  <action-mappings>

    <!-- Edit user registration -->
    <action    path="/editRegistration"

type="org.apache.struts.webapp.example.EditRegistrationAction"
          attribute="registrationForm"
              scope="request"
           validate="false">
      <forward name="success"              path="/registration.jsp"/>
    </action>

    <!-- Edit mail subscription -->
    <action    path="/editSubscription"

type="org.apache.struts.webapp.example.EditSubscriptionAction"
          attribute="subscriptionForm"
              scope="request"
           validate="false">
      <forward name="failure"              path="/mainMenu.jsp"/>
      <forward name="success"              path="/subscription.jsp"/>
    </action>

    <!-- Process a user logoff -->
    <action    path="/logoff"
               type="org.apache.struts.webapp.example.LogoffAction">
      <!--forward name="success"              path="/index.jsp"/--><!--
DISABLED -->
    </action>

    <!-- Process a user logon -->
    <action    path="/logon"
               type="org.apache.struts.webapp.example.LogonAction"
               name="logonForm"
              scope="session"
              input="logon">
      <exception
                key="expired.password"

type="org.apache.struts.webapp.example.ExpiredPasswordException"
               path="/changePassword.jsp"/>
    </action>

    <!-- Save user registration -->
    <action    path="/saveRegistration"

type="org.apache.struts.webapp.example.SaveRegistrationAction"
               name="registrationForm"
              scope="request"
              input="registration"/>

    <!-- Save mail subscription -->
    <action    path="/saveSubscription"

type="org.apache.struts.webapp.example.SaveSubscriptionAction"
               name="subscriptionForm"
              scope="request"
              input="subscription">
      <forward name="subscription"    path="/subscription.jsp"/>
      <forward name="success"
path="/editRegistration.do?action=Edit"/>
    </action>


    <!-- Display the "walking tour" documentation -->
    <action    path="/tour"
            forward="/tour.htm">
    </action>

  </action-mappings>


  <!-- ========== Controller Configuration
================================ -->

  <controller>
    <!-- The "input" parameter on "action" elements is the name of a
         local or global "forward" rather than a module-relative path -->
    <set-property property="inputForward" value="true"/>
  </controller>


  <!-- ========== Message Resources Definitions
=========================== -->

  <message-resources
    parameter="org.apache.struts.webapp.example.ApplicationResources"/>

  <message-resources

parameter="org.apache.struts.webapp.example.AlternateApplicationResources"
    key="alternate">
  </message-resources>


  <!-- ========== Plug Ins Configuration
================================== -->

  <plug-in className="org.apache.struts.plugins.ModuleConfigVerifier"/>

  <plug-in
className="org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn">
    <set-property property="pathname" value="/WEB-INF/database.xml"/>
  </plug-in>

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
                     value="/WEB-INF/validator-rules.xml,
                            /WEB-INF/validation.xml"/>
  </plug-in>


</struts-config>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [REPOST] basic question about global forward

Posted by Barry Volpe <st...@childrencare.com>.
It is defined in the Action in the struts-config.
If you want a more detailed answer past the config code
in your post.

Barry



----- Original Message ----- 
From: "Julien Martin" <ju...@wanadoo.fr>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, October 15, 2003 9:10 AM
Subject: [REPOST] basic question about global forward


> Hello,
>
> I am going through the struts sample application (struts-example.war) and
I
> am trying to understand the firtst global forward.  Here it is:
>
> ***********************************
>     <forward   name="logoff"               path="/logoff.do"/>
> ***********************************
>
> How does the application knows that "logoff.do" is mapped to the logon.jsp
> page?
>
> Can anyone help please?
>
> Thanks in advance,
>
> Julien.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org