论坛首页 Web前端技术论坛

缺少对象

浏览 3358 次
锁定老帖子 主题:缺少对象
精华帖 (0) :: 良好帖 (0) :: 新手帖 (11) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-02-13  
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%
String username=request.getParameter("username").trim();
if(username.equals("dongdong")){ out.print("failure"); }else {
out.print("success");} %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script language="javascript" type="text/javascript">
function createRequest(){
var xmlHttp=false;
if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}if else (window.ActiveXObject) {
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHttpRequest");
} catch (error1){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (error2){
xmlHttp=false;
}
}
}
return xmlHttp;}

function  checkUsername(username){
var checkRet = document.fetElementById("checkRet");
check.innerHTML="稍后....";
var xmlHttp=createRequest();
var url="index.jsp?username="+username;
xmlHttp.open("get",url);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200)
if(xmlHttp.responseText=="success"){
checkRet.innerHTML="this username is not usered";
}else if(xmlHttp.responseText="failure"){
checkRet.innerHTML="this username is usering"; }


</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
username:
<input type="text" name="username"
onblur="checkUsername(this.value)" />
<div id="checkRet"></div>


</label>
<br />



</form>
</body>
</html>

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 2

1: <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%
2: String username=request.getParameter("username").trim();
3: if(username.equals("dongdong")){ out.print("failure"); }else {
4: out.print("success");} %>
5:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
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.index_jsp._jspService(index_jsp.java:56)
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:393)
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)

到底哪里的问题 谢谢大家
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics