Jsp问题求助
程序如下:loginBoke.jsp:<%@pagecontentType="text/html;charset=gb2312"%><formid="form1"meth...
程序如下:
loginBoke.jsp:
<%@ page contentType="text/html; charset=gb2312"%>
<form id="form1" method="post" action="loginBoke_do.jsp">
<p><strong>登录我的博客</strong></p>
<table width="300" border="1">
<tr>
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
<td>密  码:</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="submit" value="提交" />
<input type="reset" name="submit2" value="重置" />
</div></td>
</tr>
</table>
</form>
loginBoke_do.jsp:
<%@ page contentType="text/html; charset=gb2312"
import="java.util.Date"%>
<%
String name=request.getParameter("name");
String pass=request.getParameter("pass");
if(!(name.equals("")||pass.equals("")))
{ //如果用户提交的用户名和密码都不空返回true
name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码
%>
<center>
<b>欢迎<%=name %>的到来!</b><br>
您登录的时间为:<%=new Date().toLocaleString() %>
</center>
<%
}else{
%><center>对不起!你没有登录成功!</center><%
}
%>
运行结果:(http://localhost:8080/JSP_Ajax/loginBoke.jsp)
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /loginBoke_do.jsp at line 6
3: <%
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
6: if(!(name.equals("")||pass.equals("")))
7: { //如果用户提交的用户名和密码都不空返回true
8: name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码
9: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
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)
root cause
java.lang.NullPointerException
org.apache.jsp.loginBoke_005fdo_jsp._jspService(loginBoke_005fdo_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
请各位大侠帮帮忙哦~
呵呵··很感谢大家的帮助··用户名那个确实写错了··可是还是出现错误··而且提示是loginBoke_do.jsp文件里的错误··exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /loginBoke_do.jsp at line 6
3: <%
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
6: if(!(name.equals("")||pass.equals("")))
7: { //如果用户提交的用户名和密码都不空返回true
8: name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码 展开
loginBoke.jsp:
<%@ page contentType="text/html; charset=gb2312"%>
<form id="form1" method="post" action="loginBoke_do.jsp">
<p><strong>登录我的博客</strong></p>
<table width="300" border="1">
<tr>
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
<td>密  码:</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="submit" value="提交" />
<input type="reset" name="submit2" value="重置" />
</div></td>
</tr>
</table>
</form>
loginBoke_do.jsp:
<%@ page contentType="text/html; charset=gb2312"
import="java.util.Date"%>
<%
String name=request.getParameter("name");
String pass=request.getParameter("pass");
if(!(name.equals("")||pass.equals("")))
{ //如果用户提交的用户名和密码都不空返回true
name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码
%>
<center>
<b>欢迎<%=name %>的到来!</b><br>
您登录的时间为:<%=new Date().toLocaleString() %>
</center>
<%
}else{
%><center>对不起!你没有登录成功!</center><%
}
%>
运行结果:(http://localhost:8080/JSP_Ajax/loginBoke.jsp)
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /loginBoke_do.jsp at line 6
3: <%
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
6: if(!(name.equals("")||pass.equals("")))
7: { //如果用户提交的用户名和密码都不空返回true
8: name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码
9: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
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)
root cause
java.lang.NullPointerException
org.apache.jsp.loginBoke_005fdo_jsp._jspService(loginBoke_005fdo_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
请各位大侠帮帮忙哦~
呵呵··很感谢大家的帮助··用户名那个确实写错了··可是还是出现错误··而且提示是loginBoke_do.jsp文件里的错误··exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /loginBoke_do.jsp at line 6
3: <%
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
6: if(!(name.equals("")||pass.equals("")))
7: { //如果用户提交的用户名和密码都不空返回true
8: name=new String(name.getBytes("ISO-8859-1"));//处理中文乱码 展开
4个回答
展开全部
<tr>
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
String name=request.getParameter("name");
写错了
你没有用户名这项
还有处理中文最好用GBK或者UTF-8比较安全 字符的处理要放在接受数据之前。。。如果还有问题 就要看最新的报错提示了
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
String name=request.getParameter("name");
写错了
你没有用户名这项
还有处理中文最好用GBK或者UTF-8比较安全 字符的处理要放在接受数据之前。。。如果还有问题 就要看最新的报错提示了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
页面中table中写错了,两个输入框中的name都是"pass"
而你在<% %>中写的是
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
<tr>
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
<td>密 码:</td>
<td><input type="password" name="pass" /></td>
</tr>
手误了吧!
而你在<% %>中写的是
4: String name=request.getParameter("name");
5: String pass=request.getParameter("pass");
<tr>
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
</tr>
<td>密 码:</td>
<td><input type="password" name="pass" /></td>
</tr>
手误了吧!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<td>用户名:</td>
<td><input type="text" name="pass" /></td>
改成<td><input type="text" name="name" /></td>即可
<td><input type="text" name="pass" /></td>
改成<td><input type="text" name="name" /></td>即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你判断的时候应该有问题应该是
if(name!=null && pass!=null &&!name.trim().equals("")&& !pass.trim().equals(""))
{
}
你试试!
if(name!=null && pass!=null &&!name.trim().equals("")&& !pass.trim().equals(""))
{
}
你试试!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询