The <jsp:forward>
forwards a client request to the url declared on the page
attribute.
I also need to mention that in your example, you should have a /
as first character inside your page
declaration, if you want to specify a relative URL, i.e.:
This, in effect, is translated as a redirection to (if localhost)
http://localhost:8080/MyAPP/landing.do? (yours would have been translated to http://localhost:8080/MyAPPLanding.do?)
The ?
allows you to append application/x-www-form-urlencoded
parameters into your declaration.
More info here.
To know what landing.do
does, do the following:
- Go to your
struts-config.xml
(found in WEB-INF
folder in your project) file and find any action (<action>
) that a path="/landing"
) attribute.
- Once you find your action, there's an attribute called
type
(inside that action). The type is a the class name of the action class that Struts calls to execute the action. The class name is fully qualified name.
- Open the java file of the class (if it exists) and depending on the action (
Action
, DispatchAction
, LookupDispatchAction
), you will have to find its mappings and see what method Struts invokes.
- In your example, my assumption will be based that your
landing.do
is of type Action
. Therefore, read what the execute()
method does. All actions actually, is execute()
by Struts. The other actions are just Template Method
patterns that knows what method to call by some mapping.