Question

for example

    <global-forwards>
      <forward name="welcome"  path="/Welcome.do"/>
    </global-forwards>

    <action-mappings>
      <action path="/Welcome" forward="/welcomeStruts.jsp"/>
    </action-mappings>

My question is: When client requests Welcome.do page, the global forward will map the /welcome.do page with the name attribute "welcome". Then in action-mapping it will map between the name in forward tag with the path in action tag so it will know that it should forward to the welcomeStruts.jsp file.
Am I correct?
If not, how can it determine the correct mapping between user's request *.do to the corresponding jsp file?
Thank you

Was it helpful?

Solution

You're not correct. When a request comes in, Struts tries to map the URL or the request with the path of an action. Forwards are not used at this stage.

When the action returns a forward name, Struts first looks for a forward with this name in the forwards of the action, and if not found, it looks in the global forwards.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top