http://localhost:8083/WebModule1/operate.jsp?no=z002
operate.jsp中对应的代码
<jsp:useBean id="equipmentBean" scope="page" class="jfgl.EquipmentBean"/>
<%
  String equip_no =request.getParameter("no");
  equip_no = new String(equip_no.getBytes("ISO-8859-1"),"GBK");
  Equipment em = equipmentBean.getEquip(equip_no);
 // Equipment em = equipmentBean.getEquip("笔记本");将上面那句改成这个
%>
EquipmentBean.java中对应的代码
  public Equipment getEquip(String no) throws Exception {
    String sql = "select * from equipment where no = '" + no + "'";
//    String sql = "select * from equipment where name = '" + no + "'";同上
    ResultSet rs = sb.executeQuery(sql);
    Equipment e = null;
    while (rs.next()) {
      e = new Equipment();
      e.setNo(rs.getString("no"));
      e.setName(rs.getString("name"));
      e.setTheclass(rs.getString("theclass"));
      e.setDescription(rs.getString("description"));
      e.setValue(rs.getDouble("value"));
      e.setCount(rs.getInt("count"));
      e.setP_info(rs.getString("p_info"));
      e.setLocation(rs.getString("location"));
      e.setAdmin(rs.getString("admin"));
      e.setStatus(rs.getString("status"));
    }
    return e;
  }
出现下面的错误:The server encountered an internal error () that prevented it from fulfilling this request.
而我将程序改成//所示的,就可以了我的equipment表中有no,name属性
程序是在jbuilder2005中调试
谢谢大家了

解决方案 »

  1.   

    忘了一点,http://localhost:8083/WebModule1/operate.jsp?no=笔记本
    Equipment em = equipmentBean.getEquip("笔记本");这里有点偷懒,呵呵
      

  2.   

    String equip_no =request.getParameter("no");
    ---------------------
    “no”如果是汉字,存在转码的问题。
      

  3.   

    String sql = "select * from equipment where [no] = '" + no + "'";
      

  4.   

    no与name都是文本格式的,为了方便数据库是access中做的
    回:trumplet(检查) 
           如果要转码的话,为什么name可以成功呢?现在用jbuilder一直都有问题一样,特麻烦,不仅仅是这点问题,而且我在每个页面都加上<%@ page contextType="text/html;charset=gb2312" %>可是查询时中文都有问题,比方要加上这句才行查询中文字段equip_no = new String(equip_no.getBytes("ISO-8859-1"),"GBK");回:kongxiangli(笑看红尘)
         加上这个就行?什么员应啊,以前都没这样写过啊?
      

  5.   

    你已经转码了:equip_no = new String(equip_no.getBytes("ISO-8859-1"),"GBK");no很可能是关键字,写成[no],是为了使数据库避免把它解释成关键字。
      

  6.   

    十分感谢,问题解决!可是有点不明白,
    no确实是关键字,我有个地方String sql = "select * from stock where name = '" + name+ "'";在这里name是关键字怎么又可以了呢?具体的方法内容和上面的一样