geren.html
<!----geren.jsp----------->
<%@ include file="index_top.html"%>
<SCRIPT language=JavaScript src="../css/sh.js"></SCRIPT>
<SCRIPT language=JavaScript src="../css/calendar.js"></SCRIPT>
<SCRIPT language="javascript">
//checkfrom函数用以确保关键字不为空function  checkform(Frm)
{  
   var flag=true;
   if  (Frm.branch_no.value=="" || Frm.start_date.value=="" ||Frm.start_date.value=="")
       { 
    alert("机构\开始时间\结束时间不能为空,请检查!");
    flag=false;
}
return flag;
}
</SCRIPT>
<html>
<head>
<title>提交表单例子</title>  
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head><body>
<div align="center">
<form id="form1" name="form1" method="post" action="guodu.jsp">
<p>请输入内容</p>
<table width="450"   border="0">
<tr>
    <td  width="112">
    <div align="center">代码:</div>
</td>
<td  width="112">
    <select name="branch_no">
<option selected>请选择</option>
<option value="123000">a1</option>
<option value="12400">a2</option>

</select>
<input type="hidden" name="strPage"  value="-1">
</td>
<td  width="112">
    <div align="center"><IMG src="../image/sj-s.gif" alt="查询标签" width="10" height="10">起始时间:</div>
</td>
<td  width="112">
    <INPUT class=input 
       onmouseover="this.style.backgroundColor='#F0F1FF'" 
       onclick="fPopCalendar(start_date,start_date);judge='1';return false" 
       onmouseout="this.style.backgroundColor=''" size=10 name=start_date>
</td>
</tr>
<tr>
    <td  width="112">
    <div align="center">代理人工号:</div>
</td>
<td  width="112">
    <input id="author" type="text" name="sales_no">

</td>
<td  width="25%">
    <div align="center"><IMG src="../image/sj-s.gif" alt="查询标签" width="10" height="10">结束时间:</div>
</td>
<td  width="112">
    <INPUT class=input 
                  onmouseover="this.style.backgroundColor='#F0F1FF'" 
                  onclick="fPopCalendar(end_date,end_date);judge='1';return false" 
                  onmouseout="this.style.backgroundColor=''" size=10 name=end_date>

</td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="查询"   onClick="return checkform(form1)">
<input type="reset"  name="Submit2" value="重写">
</form>
 
</div>
</body>
</html>guodu.jsp
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.util.*"%>
<%@page import="java.*"%>
<%@page import="javax.*"%>
<%@page import="java.sql.*,java.lang.Double.*"%>
<%@include file="con_db.jsp"%><HTML>
<head>
<title>注册</title>
</head>
<body bgcolor="#FFFFFF" text="#000000"><div>
<%  String  branch_no =request.getParameter("branch_no").trim();
String  sales_no =request.getParameter("sales_no").trim();
String  start_date =request.getParameter("start_date").trim();
String  end_date =request.getParameter("end_date").trim();


strSql = "{call dbo.agent_prem_sum_proc(?,?,?,?)}";
sqlStmt = sqlConn.prepareCall(strSql);
sqlStmt.setString(1,start_date);
sqlStmt.setString(2,end_date);
sqlStmt.setString(3,branch_no);
sqlStmt.setString(4,sales_no);
sqlStmt.executeUpdate();
                    
sqlRs.close();
sqlStmt.close();
sqlConn.close();%><jsp:forward page="page_dir.jsp"/>
</div>
</body>
</HTML>输入内容提交后出现这样的 帮忙看看会是什么原因这个是con_db.jsp
<!---调用ROCEDURE用的连接数据库用--->
<%@ page session="true" %>
<%@ page import="java.sql.*"%>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=aadb"; 
String id="sa";
String password="sa";
Connection sqlConn= DriverManager.getConnection(url,id,password);CallableStatement sqlStmt=null;    //
ResultSet sqlRs = null;
String strSql;
//String user;
//String sysuser;
//String sysuserType;
//String action;%>
HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause java.lang.NullPointerException
org.apache.jsp.jsp.guodu_jsp._jspService(guodu_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.

解决方案 »

  1.   

    String strSql;///这个没有赋值吧
      

  2.   

    root cause java.lang.NullPointerException
    org.apache.jsp.jsp.guodu_jsp._jspService(guodu_jsp.java:86)去看看guodu.jsp翻译成servlet guodu_jsp.java得86行
      

  3.   

    楼上的方法好,你自己也可以用ECLIPSE里调试呀
      

  4.   

    在guodu.jsp中:
    String  branch_no =request.getParameter("branch_no").trim();
    String  sales_no =request.getParameter("sales_no").trim();
    String  start_date =request.getParameter("start_date").trim();
    String  end_date =request.getParameter("end_date").trim();
    改写成:
    String  branch_no =request.getParameter("branch_no");
    String  sales_no =request.getParameter("sales_no");
    String  start_date =request.getParameter("start_date");
    String  end_date =request.getParameter("end_date");if(branch_no!=null && branch_no.trim().length()>0){
        branch_no = branch_no.trim();
    }
    else{
        branch_no = null;
    }
     
    ......
    如果哪一个参数要求不能为空, 还要做下判断.
      

  5.   

    谢谢各位 
    再次问下
    <%  String  branch_no =request.getParameter("branch_no").trim();
    out.println(request.getParameter("branch_no").trim());


      %>
     <% out.println(branch_no); %> //可以显示branch_no <c:out value="${branch_no}"/>  这里怎么不能输出值  是不是语法错误?该如何设置使得值就是request 的<sql:query var="query_qijiao" dataSource="${JDB}" sql="select *  from ##agent_prem_sum where agent_branch_no='这里' ">   //条件也就是要是request的
    </sql:query>
      

  6.   

    jsp里有这个标签吗?<c:out value="${branch_no}"/> ???如果只是一个变量可以直接用<%=branch_no%> 不需要<% out.println(branch_no); %>
      

  7.   

    是引用JSTL的啊  
    ${branch_no }是引用一个变量的
      

  8.   

    HOHO  
    who can  help me  ?
      

  9.   

    靠,
    解决了  单引号的问题
    准备揭贴ING!