Re: System Exception Handling in Struts

2003-11-24 Thread Gurpreet Dhanoa
hi

As such you cannot control when system exception occur not in EJB also.

THough using follwoing code you can always transfer the user to the well
formed error page if in case it occurs.


public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response){

if (this.isCancelled(request)){
System.out.println(*The user pressed cancelled!!!);
return (mapping.findForward(poststory.success));
}

PostStoryForm postStoryForm = (PostStoryForm) form;
//org.apache.struts.action.DynaActionForm postStoryForm =
(org.apache.struts.action.DynaActionForm) form;

HttpSession session = request.getSession();

MemberVO memberVO = (MemberVO) session.getAttribute(memberVO);

try{
System.out.println(I am in post story**);
StoryVO storyVO = new StoryVO();

storyVO.setStoryIntro(postStoryForm.getStoryIntro());
storyVO.setStoryTitle(postStoryForm.getStoryTitle());
storyVO.setStoryBody(postStoryForm.getStoryBody());

/*storyVO.setStoryIntro((String)postStoryForm.get(storyIntro));
storyVO.setStoryTitle((String)postStoryForm.get(storyTitle));
storyVO.setStoryBody((String)postStoryForm.get(storyBody));*/
storyVO.setStoryAuthor(memberVO);
storyVO.setSubmissionDate(new java.sql.Date(System.currentTimeMillis()));
storyVO.setComments(new Vector());

StoryManagerBD storyManager = new StoryManagerBD();
storyManager.addStory(storyVO);


System.out.println(I am done with post story**);
}
catch(Exception e){
System.err.println(An application exception has been raised in
PostStory.perform():  + e.toString());
return (mapping.findForward(system.failure));
}

return (mapping.findForward(poststory.success));
}

Hoope this will help

Cheers
Gary


- Original Message -
From: [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, November 24, 2003 3:12 PM
Subject: System Exception Handling in Struts


 Hello,
 How can I handle a system exception in Struts?
 Is Logging an internal part of Struts if yes how to configure it.

 Please help with an example if possible.

 Alok Garg
 Polaris Software Lab Ltd.
 ( + 91 - 022 - 28290019 Ext. # 1308 )









 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: System Exception Handling in Struts

2003-11-24 Thread Kalra, Ashwani
Logging is not part of struts. You can configure any logging api with
struts. Struts doesnt assume any thing. For eg.
put your log4.properties/xml  file in classpath and log4.jar and start using
the way you do it with other applications 

/Ashwani




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 3:12 PM
To: Struts Users Mailing List
Subject: System Exception Handling in Struts


Hello,
How can I handle a system exception in Struts?
Is Logging an internal part of Struts if yes how to configure it.

Please help with an example if possible.

Alok Garg
Polaris Software Lab Ltd.
( + 91 - 022 - 28290019 Ext. # 1308 )





This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst  Young Group. It is intended only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: System Exception Handling in Struts

2003-11-24 Thread Gerhard Kreutzer
[EMAIL PROTECTED] wrote:

Hello,
How can I handle a system exception in Struts?
Is Logging an internal part of Struts if yes how to configure it.
Please help with an example if possible.
 

http://www.kreutzersoft.de/java/servlets/servlet-jsp/log4j/ksct-log4j.pdf

HTH
gerhard
--
KreutzerSoft
Bärenbühlgraben 76, 90475 Nürnberg
Tel: +49-911-8324-57
Fax: +49-911-8324-61
mailto:[EMAIL PROTECTED]
http://www.KreutzerSoft.de 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]