I am just getting started on web app development. I have an index.jsp that has just ONE line.
< jsp:forward page=”landing.do?”/>
the above line do?
page=”landing.do?” actually refer to?
what does the question mark “?” next to “landing.do?” signify?
As Bozho rightly pointed out, a servlet called “action” is mapped to handle “*.do” in my web.xml (as shown below).
<servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>
How do I find out what the servlet “action” corresponding to “landing.do” actually does?
<jsp:forward> forwards a client request to the url declared on the
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)
? 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
WEB-INFfolder in your project) file and find any action (
<action>) that a
- 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 (
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.dois of type
Action. Therefore, read what the
execute()method does. All actions actually, is
execute()by Struts. The other actions are just
Template Methodpatterns that knows what method to call by some mapping.
- you probably have a servlet mapped to handle
*.doin your web.xml
?means nothing here – generally it marks the start of get parameters (like
forwardchanges the current page with the specified, without the client knowing the change has happened.
This line will forward user to another page of the site, in particular to landing.do
page=”landing.do?” actually refer to some page of the site landing.do. I believe this page is written with Struts framework. (But can be other)
what does the question mark “?” next to “landing.do?” mean nothing in this case. Generally after “?” there should be a list of request parameters. In this cases there will just be no parameters.
You should find servlet class which is mapped to that servlet name. After that you will be able to try to understand what that servlet class does. Also, look at the Struts tutorials or specification to get understanding of Struts framework workflows.