使用 WCS7.0 FrameWork 进行 Jsp 和 Ejb 中的异常处理
我正在 WCS7.0 框架中工作。我必须对一些 EJB 代码进行异常处理,例如,如果发生 finder 异常,我必须在相应的 jsp 上显示一条消息“未找到数据”。
下面是EJB代码,
TypedProperty delParam = new TypedProperty();
String shipid = rspProp.getString("shipid");
String addrId=rspProp.getString("addrId");
AddressAccessBean address = new AddressAccessBean();
address.setInitKey_AddressId(addrId);
try {
if((address.getMemberId().equals(memberid)) && address.getAddressField3().equals(shipid)){
address.getEJBRef().remove();
}
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FinderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoveException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我将如何在jsp上显示消息。
I m doing work in WCS7.0 framework.I have to do exception handling of some EJB's code, eg if finder exception occurs i have to show a message on corresponding jsp "Data not Found".
below is EJB code
TypedProperty delParam = new TypedProperty();
String shipid = rspProp.getString("shipid");
String addrId=rspProp.getString("addrId");
AddressAccessBean address = new AddressAccessBean();
address.setInitKey_AddressId(addrId);
try {
if((address.getMemberId().equals(memberid)) && address.getAddressField3().equals(shipid)){
address.getEJBRef().remove();
}
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FinderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoveException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
what will i do to show message on jsp.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议阅读 IBM Websphere commerce 7 信息中心的第一个教程“创建业务逻辑”
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0 /index.jsp
教程>编程模型>创建业务逻辑
它解释了如何使用 struts 绑定操作和 jsp 页面。
I would recommend to read the first tutorial from IBM Websphere commerce 7 infocenter "Createing business logic"
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp
tutorials > programming model > Creating business logic
It explains how to bind actions and jsp pages using struts.
您可以将其作为响应属性返回以显示在 JSP 视图上。
或
引发应用程序异常以在通用错误页面上显示错误。
抛出新的 ECApplicationException(e);
You could either return it as a response property to show on your JSP view.
or
Throw an application exception to show the error on an generic error page.
throw new ECApplicationException(e);