html页面的表单提交给jsp页面显示,jsp页面报错,
01.html<html><head><title>利用表单传递数据</title></head><body><h3>利用表单传递数据</h3><formname="fo...
01.html
<html>
<head>
<title>利用表单传递数据</title>
</head>
<body>
<h3>利用表单传递数据</h3>
<form name="form1" method="post" action="02.jsp">
<p>你的姓名:
<input type="text" name="name">
</p>
<p>你的爱好:
<input type="text" name="hobby">
</p>
<p>你所从事的行业:
<select name="work">
<option value="学生">学生</option>
<option value="IT业" selected>IT业</option>
<option value="商业">商业</option>
<option value="制造业">制造业</option>
<option value="服务业">服务业</option>
</select>
</p>
<p>
<input type="Submit" value="提交">
<input type="Reset" value="重置">
</p>
</form>
</body>
</html>
02.jsp
<html>
<head>
<title>从表单中获取数据</title>
</head>
<%@ page language="java" import="java.util.*" contentType="text/html;charset=GB2312"%>
<body>
<h3>从表单中获取数据</h3>
<p>
<%
//从表单中获取数据
String name=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK");
String hobby=new String(request.getParameter("hobby").getBytes("ISO8859_1"),"GBK");
String work=new String(request.getParameter("work").getBytes("ISO8859_1"),"GBK");
//验证"名字(name)"的长度是否符合要求
if(name.length()<3||name.length()>8)
out.println("你输入的名字长度不符合要求");
else
{
out.println("你的姓名是:"+name+"<br>");
out.println("你的爱好是:"+hobby+"<br>");
out.println("你所从事的工作是:"+work+"<br>");
//将"名字(name)"保存到session对象中,让后续页面(下个页面、下下个页面、……)引用
session.setAttribute("name",name);
}
%>
<br>
<!--将"爱好(hobby)"和"工作(work)"以链接的形式传递给下个页面-->
<a href="03.jsp?hobby=<%=hobby%>&work=<%=work%>">提交</a>
</p>
<hr>
<p><font size="2">*将"名字(name)"保存到session对象中,让后续页面(下个页面、下下个页面、……)引用</font></p>
<p><font size="2">*将"爱好(hobby)"和"工作(work)"以链接的形式传递给下个页面</font></p>
</body>
</html>
An error occurred at line: 1 in the generated java file
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 8 in the generated java file
The hierarchy of the type _02_jsp is inconsistent
An error occurred at line: 8 in the generated java file
The type _02_jsp must implement the inherited abstract method JspSourceDependent.getDependants()
An error occurred at line: 18 in the generated java file
Object cannot be resolved to a type
An error occurred at line: 38 in the generated java file
Object cannot be resolved to a type
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:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) 展开
<html>
<head>
<title>利用表单传递数据</title>
</head>
<body>
<h3>利用表单传递数据</h3>
<form name="form1" method="post" action="02.jsp">
<p>你的姓名:
<input type="text" name="name">
</p>
<p>你的爱好:
<input type="text" name="hobby">
</p>
<p>你所从事的行业:
<select name="work">
<option value="学生">学生</option>
<option value="IT业" selected>IT业</option>
<option value="商业">商业</option>
<option value="制造业">制造业</option>
<option value="服务业">服务业</option>
</select>
</p>
<p>
<input type="Submit" value="提交">
<input type="Reset" value="重置">
</p>
</form>
</body>
</html>
02.jsp
<html>
<head>
<title>从表单中获取数据</title>
</head>
<%@ page language="java" import="java.util.*" contentType="text/html;charset=GB2312"%>
<body>
<h3>从表单中获取数据</h3>
<p>
<%
//从表单中获取数据
String name=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK");
String hobby=new String(request.getParameter("hobby").getBytes("ISO8859_1"),"GBK");
String work=new String(request.getParameter("work").getBytes("ISO8859_1"),"GBK");
//验证"名字(name)"的长度是否符合要求
if(name.length()<3||name.length()>8)
out.println("你输入的名字长度不符合要求");
else
{
out.println("你的姓名是:"+name+"<br>");
out.println("你的爱好是:"+hobby+"<br>");
out.println("你所从事的工作是:"+work+"<br>");
//将"名字(name)"保存到session对象中,让后续页面(下个页面、下下个页面、……)引用
session.setAttribute("name",name);
}
%>
<br>
<!--将"爱好(hobby)"和"工作(work)"以链接的形式传递给下个页面-->
<a href="03.jsp?hobby=<%=hobby%>&work=<%=work%>">提交</a>
</p>
<hr>
<p><font size="2">*将"名字(name)"保存到session对象中,让后续页面(下个页面、下下个页面、……)引用</font></p>
<p><font size="2">*将"爱好(hobby)"和"工作(work)"以链接的形式传递给下个页面</font></p>
</body>
</html>
An error occurred at line: 1 in the generated java file
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 8 in the generated java file
The hierarchy of the type _02_jsp is inconsistent
An error occurred at line: 8 in the generated java file
The type _02_jsp must implement the inherited abstract method JspSourceDependent.getDependants()
An error occurred at line: 18 in the generated java file
Object cannot be resolved to a type
An error occurred at line: 38 in the generated java file
Object cannot be resolved to a type
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:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) 展开
4个回答
展开全部
报什么错误,可以把错误消息贴出来看看
追问
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
报什么错也不贴出来?
追问
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
html是静态页面,将01.html 改成01.jsp
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询