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
Author

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,
Author
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Dec 07, 2008
Posts: 17
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
 
 
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