首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

这个咋回事

2013-09-11 
这个怎么回事?jsp文件如下:%@pagelanguage java import java.util.* pageEncoding gb2312 %%@

这个怎么回事?
jsp文件如下:
<%@   page   language= "java "   import= "java.util.* "   pageEncoding= "gb2312 "%>
<%@   taglib   prefix= "c "   uri= "http://java.sun.com/jstl/core "   %>
<%@   page   contentType= "text/html "   %>

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
    <head>
        <title> My   JSP   'jsp.jsp '   starting   page </title>
    </head>
   
    <body>
    <form   method= "post ">
      <jsp:useBean   id= "userinfo "   class= "myBeans.userInfo "   scope= "page ">
      </jsp:useBean>
      <jsp:getProperty   id= "userinfo "   property= "userName.getName "   />  
      </form>
    </body>
</html>

类文件如下:
package   myBeans;

public   class   userInfo   {
private   String   userName;

public   String   getName(){
return   this.userName;
}

public   void   setName(String   name){
this.userName   =   name;
}
public   userInfo(){
this.userName   =   "aaa ";
}
}

运行的时候报错:
HTTP   Status   500   -  

--------------------------------------------

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   /JSTL/jsp.jsp(15,3)   GetProperty:   Mandatory   attribute   name   missing
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:196)
org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:283)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:473)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1062)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)




note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.9   logs.



[解决办法]
<jsp:getProperty id= "userinfo " property= "userName.getName " /> 有问题吧
是不是userName.getName()不记得了,很少这样用。
[解决办法]
改成这样就行了!
<jsp:useBean id= "userinfo " class= "myBeans.userInfo " scope= "page ">
<jsp:getProperty id= "userinfo " property= "userName.getName " />
</jsp:useBean>

我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行