on 08-27-2006 11:46 AM
Hi All,
I've a Web Dynpro project which uses a simple java helper class.
The java class has 'try catch' statements.
When I'm in 'catch' I want to display an error message on the screen.
I know that System.err.println writes the message in the defaultTrace.trc log file in the server but as a developer I don't always have access to the server.
Is there an option to display the error message on the screen with some kind of response object? (I cannot use wdComponentAPI.getMessageManager.reportSuccess in my helper class)
Thanks,
Omri
Hi Omri,
It's not true that you cannot use the MessageManager in your helper java classes. Here's how you can do it:
1. Create a java class in the src directory of your project and in the same packeage as your project. I think you have already done this. Let's say the class is called HelperClass.
2. Declare a public variable of type com.sap.tc.webdynpro.progmodel.api.IWDMessageManager. Call it say, msgManager. The import will be added automatically.
3. In the wdDoInit() of your WD write something like:
HelperClass helperObj = new HelperClass();
helperObj.msgManager = wdComponentAPI.getMessageManager();
4. Then when you catch the exception in your helper class, do a simple reportException().
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omri,
You are true..that you can not directly use MessageManager Class.
For that there is a work around, If that method returns a String, you can find out what exception in the Called view.
you can write in this way.
try{
return null // No Exception
}catch(Exception exp){
return exp.toString(); // If exception is there
}
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.