当前位置: 代码迷 >> Java Web开发 >> org.apache.jasper.JasperException: /HandlePage.jsp(30,3) Unable to find setter method for attribute: userid(这是什么错误)
  详细解决方案

org.apache.jasper.JasperException: /HandlePage.jsp(30,3) Unable to find setter method for attribute: userid(这是什么错误)

热度:543   发布时间:2016-04-17 14:54:45.0
org.apache.jasper.JasperException: /HandlePage.jsp(30,3) Unable to find setter method for attribute: userid(这是什么异常)

-------taglib

package   com.item.tag;
import   java.sql.Connection;
import   java.sql.ResultSet;
import   java.sql.ResultSetMetaData;
import   java.sql.Statement;
import   javax.servlet.http.HttpServletRequest;
import   javax.servlet.jsp.JspException;
import   javax.servlet.jsp.JspWriter;
import   javax.servlet.jsp.PageContext;
import   javax.servlet.jsp.tagext.BodyContent;
import   javax.servlet.jsp.tagext.BodyTag;
import   javax.servlet.jsp.tagext.Tag;

import   com.item.bean.ConnectionDatabase;

public   class   HandleTestPage   implements   BodyTag
{
private   BodyContent   body;
private   PageContext   page;
private   String   userid;


public   void   setBookid(String   userid)
{
this.userid   =   userid;
}


public   void   get()
{
//   List   data   =   null;

Connection   con   =   null;
JspWriter   out   =   page.getOut();

try
{
con   =   ConnectionDatabase.conn();
Statement   st   =   con.createStatement();
String   sql   =   "select   *   from   [firstItem].[dbo].[userManager]   where   user_id   =   "   +   userid;
ResultSet   rs   =   st.executeQuery(sql);
ResultSetMetaData   rsmd   =   rs.getMetaData();
int   cols   =   rsmd.getColumnCount();
out.print( " <input   type   =   'text '   name   =   'userid '   > ");
HttpServletRequest   request   =   null;
request.setAttribute( "userid ",   userid);
out.print( " <table   border=2>   <tr> ");

for   (int   i   =   1;   i   <   cols   +   1;   i++)
{
out.print( " <th> "   +   rsmd.getColumnName(i)   +   " </th> ");
}
out.print( " </tr> ");

while   (rs.next())
{
out.print( " <tr> ");
for   (int   i   =   1;   i   <   cols   +   1;   i++)
{
out.print( " <td> "   +   rs.getString(i)   +   " </td> ");
}
out.print( " </tr> ");
}

out.print( " </table> ");

}
catch   (Exception   e)
{
e.printStackTrace();
}
finally
{
try
{
if   (con   !=   null)
{
con.close();
}
}
catch   (Exception   e)
{
e.printStackTrace();
}
}

//   return   data;
}
public   int   doStartTag()   throws   JspException
{
//   TODO   Auto-generated   method   stub
if(userid   !=   null)
get();
return   this.SKIP_BODY;
}

public   int   doEndTag()   throws   JspException
{

return   this.EVAL_PAGE;
}
public   Tag   getParent()
  相关解决方案