This week's book giveaway is in the
Agile and other Processes
forum.
We're giving away four copies of
The Mikado Method
and have Ola Ellnestam and Daniel Brolund on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
where to write the code for intercepts
Aditi Gandy
Ranch Hand
Joined: Apr 23, 2008
Posts: 37
posted
Dec 25, 2008 23:11:00
0
Hi, I am new to Struts and wanted to know how to make example of Helloworld in Struts2 stateless and where to write the code for intercepts?
Can anyone please help me?
Thanks & Regards,
Author
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Dec 26, 2008 05:30:00
0
It's not clear to me what you're asking.
Stephanie Dutcheson
Greenhorn
Joined: Dec 07, 2008
Posts: 17
posted
Dec 26, 2008 07:27:00
0
You define interceptor in struts.xml
<interceptors>
<interceptor name="authentication" class="com.onepd.struts2.lesson.action.Authentication"/>
<interceptor-stack name="secureStack">
<interceptor-ref name="authentication"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
implements Interceptor in say Authentication class, method intercept()
will do all job.
or set
<global-results>
<result name="error" type="redirectAction">
...
</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
to process exceptions.
-----
Struts 2 tutorial
http://www.onepd.com
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: where to write the code for intercepts
Similar Threads
where to write session related code
Detecting Servlet timeout using ajax/post.
Where Do I Create Session, Set Attribute, etc. In Struts?
Caching rendered html in jsp
Changing the value of a rich:comboBox
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter