You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bard A. Evjen" <ba...@operamail.com> on 2003/11/07 13:30:32 UTC

PLEASE HELP: Exception handling

Can anyone provide me with a complete example of using execption handling in
struts that supports a "nice" message to the user and the actual error
message (displayed on the jsp page)? (I'm using struts 1.1)

I think I've tried everything now (well, obviously not everything since it
is not working), so I would REALLY appreciate the help.

You can either point me to a page where I can download a complete example or
you can send it to me on bardevjen at operamail.com

Thanks a lot!

Regards,
Bard




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: PLEASE HELP: Exception handling

Posted by Vic Cekvenich <ce...@baseBeans.com>.
Say this in WEB.XML
<error-page>
	<exception-type>java.lang.Exception</exception-type>
	<location>/error.jsp</location>
</error-page>	

Then this in error.jsp or what ever you consider friendly:
<%@ page isErrorPage ="true" %>

You are at a J2EE error page:
<p>
<%= exception.getMessage() %>

and then:

throw new Exception("Oops, I did it again");
Or if you want to localize.

There are many variations, but KISS will start you.
.V

Bard A. Evjen wrote:

> Can anyone provide me with a complete example of using execption handling in
> struts that supports a "nice" message to the user and the actual error
> message (displayed on the jsp page)? (I'm using struts 1.1)
> 
> I think I've tried everything now (well, obviously not everything since it
> is not working), so I would REALLY appreciate the help.
> 
> You can either point me to a page where I can download a complete example or
> you can send it to me on bardevjen at operamail.com
> 
> Thanks a lot!
> 
> Regards,
> Bard

-- 
Victor Cekvenich,
Struts Instructor
(215) 321-9146

Advanced Struts Training
<http://basebeans.com/do/cmsPg?content=TRAINING> Server Side Java
training with Rich UI, mentoring, designs, samples and project recovery
in North East.
Simple best practice basic Portal, a Struts CMS, Membership, Forums,
Shopping and Credit processing, <http://basicportal.com> software, ready
to develop/customize; requires a db to run.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org