日期:2014-05-19  浏览次数:20746 次

jsp中的问题
下面是我的一段代码:
  <%@ page language="java" import="java.util.*" pageEncoding="gbk"%>

<%@ page import="com.job.*"%>
<%@ page import="com.util.*"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>

<jsp:useBean id="Czhaopin" class="com.job.Czhaopin" scope="request" />
<jsp:setProperty name="Czhaopin" property="*" />
<html>
<body>
<%=Czhaopin.getCs()%>
<%=Czhaopin.getCworkAge()%>
<%=Czhaopin.getCztype()%>
<%=Czhaopin.getCe()%>
<%=Czhaopin.getCftim()%>
<%=Czhaopin.getCgongAdd()%>
<%=Czhaopin.getChangye()%>
<%
DataBaseOperation DOP = new DataBaseOperation();
String changye[] = request.getParameterValues("changye");
for (int i = 0; i < changye.length; i++) {
String hangye = "ssssss";
String Changye;
Changye=changye[i]+hangye;
}
String cztype[] = request.getParameterValues("cztype");
for (int k = 0; k < cztype.length; k++) {
String ztype = " ";
String Cztype;
Cztype=cztype[k] + ztype;

}

String name = "124";

String sql = "INSERT INTO zpin(name,Changye,Cztype,CgongAdd,CworkAge,CE,CS) VALUES('"
+ name
+ "','"
+ Changye
+ "','"
+ Cztype
+ "','"
+ Czhaopin.getCgongAdd()
+ "','"
+ Integer.parseInt(Czhaopin.getCworkAge())
+ "','" 
+ Integer.parseInt(Czhaopin.getCe())
+ "','"
+ Integer.parseInt(Czhaopin.getCs()) + "')";
int i = DOP.insert(sql);
out.println(i + name);
if (i == 1) {
out.print("<script>alert('注册成功!');document.location='CompanyFrist.jsp';</script>");
return;
} else {
out.println("<script>alert('注册失败!');document.location='Czhaopin.jsp';</script>");
}

%>
<br>
</body>
</html>
调试的时候报下面错误:
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 39 in the jsp file: /company/CzhaopinDo.jsp
Changye cannot be resolved
36: String sql = "INSERT INTO zpin(name,Changye,Cztype,CgongAdd,CworkAge,CE,CS) VALUES('"
37: + name
38: + "','"
39: + Changye
40: + "','"
41: + Cztype
42: + "','"


An error occurred at line: 41 in the jsp file: /company/CzhaopinDo.jsp
Cztype cannot be resolved
38: + "','"
39: + Changye
40: + "','"
41: + Cztype
42: + "','"
43: + Czhaopin.getCgongAdd()
44: + "','"


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.Js