wood burning stoves*
The moose likes Struts and the fly likes where to write the code for intercepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "where to write the code for intercepts" Watch "where to write the code for intercepts" New topic

where to write the code for intercepts

Aditi Gandy
Ranch Hand

Joined: Apr 23, 2008
Posts: 37
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,
David Newton

Joined: Sep 29, 2008
Posts: 12617

It's not clear to me what you're asking.
Stephanie Dutcheson

Joined: Dec 07, 2008
Posts: 17
You define interceptor in struts.xml
<interceptor name="authentication" class="com.onepd.struts2.lesson.action.Authentication"/>
<interceptor-stack name="secureStack">
<interceptor-ref name="authentication"/>
<interceptor-ref name="defaultStack"/>

implements Interceptor in say Authentication class, method intercept()
will do all job.

or set

<result name="error" type="redirectAction">

<exception-mapping exception="java.lang.Exception" result="error"/>

to process exceptions.

Struts 2 tutorial
subject: where to write the code for intercepts
Similar Threads
Detecting Servlet timeout using ajax/post.
where to write session related code
Where Do I Create Session, Set Attribute, etc. In Struts?
Caching rendered html in jsp
Changing the value of a rich:comboBox