-1
私は次のサーブレットを実行します。なぜ私はorg.apache.jasper.JasperExceptionを取得していますか?
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
public class Controller extends HttpServlet {
@Override
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException {
Bean bean = new Bean();
bean.setName("Suhail Gupta");
request.setAttribute("Name", bean);
RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
rd.forward(request, response);
}
}
例外:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error() that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: PWC6054: Cannot find any information on property 'Name' in a bean of type 'Bean'
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
が生成されます。私はこれの理由を理解していない。私は例外の理由を見つけることができません
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="name" class="Bean" scope="request" />
Person created by the Servlet : <jsp:getProperty name="name" property="Name" />
</body>
</html>
:後
はビーンクラスです:
public class Bean {
private String Name = null;
public void setName(String n) {
Name = n;
}
public String getName() {
return Name;
}
}
、これはindex.jsp
ページです。
クラス 'Bean'のメンバーに' Name'の代わりに 'name'を使用し、' Controller'に属性名を使用してみてください。 – Jesper
@ Jesperは助けなかった –