1)what is global forwards in struts?
2) whait si struts navigation flow?
Answers were Sorted based on User's Feedback
Answer / prabhakar
Global forwards
================
In Struts, Global forwards(defined in struts-config.xml)
are the action forwards which can be forwarded from any
action and which is accessible to all actions.
For example, exception/error may occur from any action.So,
instead of writing forward inside every action to redirect
to error page , it is better to write a single global forward.
Ex:
<global-forwards>
<forward name="errorPage" path="pages/error.jsp" />
</global-forwards>
Note :
Request Processor will first search for local forward
Action, only if local forward is not avalible,then only it
will search in the global forwards
Struts Navigation Flow
=======================
1) When application server gets started,container loads the
web.xml
2) When first the request is made from a JSP/HTML/XSLT to
the server with a particular URI(/something.do) the control
first reaches Web.xml file.
3) It checks the mapping for /something.do in web.xml and
finds the ActionServlet and loads ActionServlet.
......
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
.....
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
4) As part of loading ActionServlet calls the init() as
every other servlet does.
(Note: ActionServlet extends HttpServlet only)
......................
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
........................
5) In init() it takes the init-parameters as
struts-config.xml and loads the xml file.
6) Then the ActionServlet calls the process() method of
RequestProcessor class.
7) process() method checks for the appropriate action in the
action mapping for current request and maps the URI to the
action in the struts-config.xml.
8) Then it creates an object to ActionForm associated to
that action.
9) It then calls the setters and reset() methods in the form
bean(Which extends ActionForm) corresponds to the mapped action.
10) If the action tag in struts-config.xml contains validate
"true" then the validate method is called.
11) if any validation errors it return to view component
(any jsp XSLT) which is specified as an attribute of input
"/error.jsp"
12) if there are no validation errors ,it then search for
execute method in the action class and executes it.
13) execute method performs the bussinesslogic which you
provide and returns with an ActionForward key.
14) Now the returned key is searched in the mapped action
which is specified as forward tag.
15) It looks for the appropriate view component and performs
the getters on that action form corresponding to this view
component and loads the view page in the browser.
- Prabhakar
Is This Answer Correct ? | 52 Yes | 6 No |
Answer / balaji
Question Posted by Etest :
what if a action has the same forward name as a global
forward. which one will be picked for the action mapping?.
Answer
1) First the locally defined forward is searched if its not found,then the global-forward is searched.
Is This Answer Correct ? | 33 Yes | 6 No |
Answer / venkateshbabu
In Struts, Global forwards are the action forwards which
can be forwarded from any action.
Consider, log out link, that will be present in all the
page, so, u can't write a forward in all the action mapping
and check. so, struts is using global forwards, whatever
forward declared in the global forwards can be visible to
all action mapping. We will use global forwards in
situtaions like logoff, error page.
---------------------------------------------------------
The question is not clear, is it Struts Navigation Flow ?
Then let me know, i will post the answer
Is This Answer Correct ? | 40 Yes | 15 No |
If multiple Action class uses the same result page means
then we have to use the globalForward.
that means multiple Action classes uses the same logical
name of ActionForward
Struts first search for local forward Action if it is not
Avalible means it has to use the GLOBALFORWARD
Is This Answer Correct ? | 11 Yes | 4 No |
Answer / etest
what if a action has the same forward name as a global
forward. which one will be picked for the action mapping?..
Is This Answer Correct ? | 10 Yes | 7 No |
How to handle non-transacted sessions with respect to jms?
Why do the JMS dbms_aqadm.add_subscriber and dbms_aqadm.remove_subscriber calls sometimes hang when there are concurrent enqueues or dequeues happening on the same queue to which these calls are issued?
How to Set message priority levels?
How does a typical client perform the communication?
Why is jms used?
What are the functionalities of a jms provider?
What is JMS application ?
What are the core JMS-related objects required for each JMS-enabled application?
Must I place all my class files in the WEB-INF folder and all JSP's outside?
0 Answers Nigerian Ports Authority,
What is MOM in reference to JMS?
Can a jms queue have multiple listeners?
What is difference between JMS and Web Services?