how can u handle run time exceptions in struts and jsp plz
explain briefly not single word answer?

Answer Posted / m.gangadhar from sathya techno

Hi.

In Struts we can handle the run time exceptions in two ways.

1).Programmatic Approach by using try& catch Blocks in
ActionSubClass

2).declarative Approach by Using <exception> in struts-
config.xml this is two ways

a) Either handle exceptions globally by using
<global-exceptions>
<exception
key="error.message"
type="java.lanag.Exception"
path="/error.jsp"/>
</global-exceptions>

In this approach if u get exception any jsp page it
automatically goes to error.jsp and their u dispay the
errors by
using <html-errors/>


b) or u can handle the exceptions as locally i.e particular
to action class

<action-mappings>
<action
name="rf"
path="/regs"
type="RegAction"
validate="true"
input="1.jsp">
<exception
key="error.message"
type="java.lanag.Exception"
path="/error.jsp"/>

</action>
</action-mappings>

Is This Answer Correct ?    46 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of @emailvalidator annotation?

489


How struts2 supports internationalization?

650


Explain about how requests from the client are sent?

518


Name some useful annotations introduced in Struts2?

528


What is the difference between empty default namespace and root namespace?

552






What is http redirect?

561


Can you explain value stack?

536


How many action classes can be used in struts application?

503


What is s token?

528


What are action errors and error and what are the consequences they impose?

561


What is struts actionmapping?

520


What do you mean by ognl?

552


What are the core classes of the struts framework?

510


What is the difference between validation.xml and validator-rules.xml files in struts?

509


How is declarative handling of exceptions done in struts ?

476