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

页面无法注册,该怎么解决

2013-09-11 
页面无法注册jsp代码:register.jsp%@pagecontentType text/htmlcharsetGB2312 %%@pageimport to

页面无法注册
jsp代码:
register.jsp
<%@   page   contentType= "text/html;charset=GB2312 "   %>
<%@   page   import= "tom.jiafei.Register "   %>
<%!
        public   String   codeString(String   s)
  {   String   str=s;
      try{   byte   b[]=str.getBytes( "ISO-8859-1 ");
                str=new   String(b);
return   str;  
            }              
      catch(Exception   e)
      {   return   str;
      }      
  }
%>
<html>
<body   bgcolor= "#FFFF00 "> <font   size=5>
<%@   include   file= "head.txt "   %>
<font   size=1>
<br> 输入您的信息,会员名字不允许含有空格,带*号项必须填写。
<%
        String   str=response.encodeURL( "register.jsp ");
%>
<form   action= " <%=str%> "   method= "post ">
<br> 会员名称 <input   type=text   name= "logname "> *
        设置密码 <input   type=password   name= "password "> *
<br> 性别(*) <input   type=radio   name= "sex "   checked= "o "   value= "男 "> 男
                      <input   type=radio   name= "sex "   value= "女 "   > 女
<br> 会员年龄 <input   type=text   name= "age "   value= "0 "> *
        电子邮件 <input   type=text   name= "email ">
<br> 联系电话 <input   type=text   name= "phone ">
        通信地址 <input   type=text   name= "address ">
<br> 输入您的简介和交友要求
<br> <TextArea   name= "message "   rows= "4 "   cols= "57 ">
        </TextArea>
<br> <input   type=submit   name= "g "   value= "提交 ">
</form>
<jsp:useBean   id= "memberlogin "   class= "tom.jiafei.Register "   scope= "request ">
</jsp:useBean>
<%
    String   logname= " ",sex= " ",age= " ",password= " ",email= " ",phone= " ",address= " ",message= " ";
    int   n=0;
    if(!(session.isNew()))
    {   logname=request.getParameter( "logname ");
        if(logname==null)
    {     logname= " ";
    }
  logname=codeString(logname);
  int   space=logname.indexOf( "   ");
  if(space!=-1)
      {         response.sendRedirect( "register.jsp ");      
      }
     
  password=request.getParameter( "password ");
          if(password==null)
      {     password= " ";
      }
  password=codeString(password);


 
  sex=request.getParameter( "sex ");
          if(sex==null)
      {     sex= " ";
      }
  sex=codeString(sex);
 
  age=request.getParameter( "age ");
          if(age==null)
      {     age= " ";
      }
  age=codeString(age);
  try{     n=Integer.parseInt(age);
        }
  catch(NumberFormatException   e)
            {     n=0;
    }
   
          email=request.getParameter( "email ");
          if(email==null)
      {     email= " ";
      }
  email=codeString(email);
 
  phone=request.getParameter( "phone ");
          if(phone==null)
      {     phone= " ";
      }
  phone=codeString(phone);  
 
  address=request.getParameter( "address ");
          if(address==null)
      {     address= " ";
      }
  address=codeString(address);
 
  message=request.getParameter( "message ");
          if(message==null)
      {     message= " ";
      }
  message=codeString(message);                                            
    }
%>
<%
                boolean   b=!(logname.equals( " "))&&!(password.equals( " "))&&(n <=150)&&(n> =0);
if(b)
{     out.print(logname);%>
<jsp:setProperty   name= "memberlogin "   property= "logname "   value= " <%=logname%> "   />
<jsp:setProperty   name= "memberlogin "   property= "password "   value= " <%=password%> "   />
<jsp:setProperty   name= "memberlogin "   property= "sex "   value= " <%=sex%> "   />
<jsp:setProperty   name= "memberlogin "   property= "age "   value= " <%=age%> "   />
<jsp:setProperty   name= "memberlogin "   property= "email "   value= " <%=email%> "   />
<jsp:setProperty   name= "memberlogin "   property= "phone "   value= " <%=phone%> "   />
<jsp:setProperty   name= "memberlogin "   property= "address "   value= " <%=address%> "   />
<jsp:setProperty   name= "memberlogin "   property= "message "   value= " <%=message%> "   />
<%
        memberlogin.addItem();  
}
else
{     out.print( "您还没有填写信息,或信息填写不完整、年龄或名字不正确 ");
}
%>      


<%   if(!(session.isNew()))
        {
%>
        <jsp:getProperty   name= "memberlogin "   property= "backNews "   />
<%
}
%>
</body>
</html>

我进入这个页面试着注册一个号,但错误提示:
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:   Can 't   find   a   method   to   write   property   'password '   of   type   'java.lang.String '   in   a   bean   of   type   'tom.jiafei.Register '
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(JspRuntimeLibrary.java:664)
org.apache.jsp.friend.register_jsp._jspService(register_jsp.java:208)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

org.apache.jasper.JasperException:   Can 't   find   a   method   to   write   property   'password '   of   type   'java.lang.String '   in   a   bean   of   type   'tom.jiafei.Register '
org.apache.jasper.runtime.JspRuntimeLibrary.getWriteMethod(JspRuntimeLibrary.java:797)
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(JspRuntimeLibrary.java:661)
org.apache.jsp.friend.register_jsp._jspService(register_jsp.java:208)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


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


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

Apache   Tomcat/5.5.23
请高手帮我看看。

[解决办法]
password 的set() get()方法写了么?
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行