<%@ page language="java" errorPage="5-03.jsp" contentType="text/html;charset=GBK" %><html>
<head>
<title>My JSP '5-02.jsp' starting page</title>
</head>
<body>
<%
int dividend=0;
int divisor=0;
int result=0;
try{
result=dividend*divisor;
}
catch(ArithmeticException zz)
{
throw new ArithmeticException("除数不能为零!");
}
%>
</body>
</html>问题:IDE(eclipse 3.2+Myeclipse)总是提示整形变量"result"(红色)为未读取的局部变量,请问这是为什么?
<head>
<title>My JSP '5-02.jsp' starting page</title>
</head>
<body>
<%
int dividend=0;
int divisor=0;
int result=0;
try{
result=dividend*divisor;
}
catch(ArithmeticException zz)
{
throw new ArithmeticException("除数不能为零!");
}
%>
</body>
</html>问题:IDE(eclipse 3.2+Myeclipse)总是提示整形变量"result"(红色)为未读取的局部变量,请问这是为什么?
int dividend=0;
int divisor=0;
// int result=0;
try{
int result=dividend*divisor;
}
catch(ArithmeticException zz)
{
throw new ArithmeticException("除数不能为零!");
}
% >
然后eclipse 给你提示这个变量是不是多了得,因为这个变量下面没有.
不是错误一般没事。感觉eclipse检查比jdk编译器还严格。汗。。
<%@ page language="java" errorPage="5-03.jsp" Encoding="GBK">
然后在5-03.jsp这个页面使用
<%@ page language="java" isErrorPage="true" Encoding="GBK">
以上红色的指令应该能达到5-02.jsp页面有错误然后就转向5-03.jsp页面输出错误信息吧?