我在google上搜索了这个主题并看到了一些最佳实践.但我需要一些具体的建议.我正在开发一个J2EE应用程序,它有来自JSP的servlets/Struts2 /对DAO的调用.所以应用程序是各种搞砸了.大多数数据是通过存储过程获取的,这些存储过程由iBatis ORM/Spring调用.有时当SP端发生错误时,它会向用户显示一条丑陋的消息,如下所示:
javax.servlet.ServletException: org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in debtowed.xml.
--- The error occurred while applying a parameter map.
--- Check the debtowed.getFormerTenantData.
--- Check the statement (update procedure failed).
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 11:
PLS-00905: object package.GET_FORMER_ADDRESS is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Caused by: java.sql.SQLException: ORA-06550: line 1, column 11:
PLS-00905: object package.GET_FORMER_ADDRESS is invalid
ORA-06550: line 1, column 7: …Run Code Online (Sandbox Code Playgroud) public abstract class Master
{
public void printForAllMethodsInSubClass()
{
System.out.println ("Printing before subclass method executes");
System.out.println ("Parameters for subclass method were: ....");
}
}
public class Owner extends Master {
public void printSomething () {
System.out.println ("This printed from Owner");
}
public int returnSomeCals ()
{
return 5+5;
}
}
Run Code Online (Sandbox Code Playgroud)
不搞乱子类的方法......是否可以printForAllMethodsInSubClass()在子类的方法执行之前执行?
更新:
使用AspectJ/Ruby/Python ......等是否也可以打印参数?以上代码格式如下:
public abstract class Master
{
public void printForAllMethodsInSubClass()
{
System.out.println ("Printing before subclass method executes");
}
}
public class Owner extends Master {
public …Run Code Online (Sandbox Code Playgroud)