JSP连接数据库出现的问题.(高手进)
<body><%Stringname=request.getParameter("uname");Stringpassword=request.getParameter(...
<body>
<%
String name =request.getParameter("uname") ;
String password =request.getParameter("password") ;
%>
<%
JNDIconn jc = new JNDIconn() ;
Statement stat = null;
ResultSet rs = null;
Connection conn = null ;
UserInfo ui = null ;
try
{
conn = jc.getConnection() ;
stat = conn.createStatement() ;
rs = stat.executeQuery("select * from manager") ;
while(rs.next())
{
if(rs.getString("name").equals(name)&&rs.getString("password").equals(password))
{
ui = new UserInfo() ;
ui.setUserName(rs.getString("name")) ;
ui.setPassword(rs.getString("password")) ;
ui.setSex(rs.getString("sex")) ;
ui.setAge(rs.getInt("age")) ;
ui.setOName(rs.getString("OName")) ;
ui.setAdress(rs.getString("adress")) ;
ui.setEmail(rs.getString("Emai")) ;
session.setAttribute("name","sd") ;
session.setAttribute("OName","sdsd") ;
%>
<jsp:forward page="goScucessful.jsp"/>
<%
break ;
}
}
if(ui.getAdress()=="")
{
%>
<jsp:forward page="FailToGo.jsp"/>
<%
}
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
rs.close() ;
stat.close() ;
conn.close() ;
}
catch (SQLException e)
{
System.out.println(jc.toString()+"这个数据库资源出现异常没有关闭!") ;
e.printStackTrace();
}
}
%>
</body>
这是我写的传入数据跟数据库中的作比较.然后跳转到相应的界面的代码..但是有问题..麻烦高手给看看.问题如下:
org.apache.jasper.JasperException: /Check.jsp(3,0) Unterminated <%@ page tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:522)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
。。。。。。。。。。
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ page import="com.method.*"%>
<%@ page import="java.sql.*"; %>
<%@ page import="com.conn.*"; %>
这是我的程序的头文件..貌似没什么问题呀..有劳高手哈.. 展开
<%
String name =request.getParameter("uname") ;
String password =request.getParameter("password") ;
%>
<%
JNDIconn jc = new JNDIconn() ;
Statement stat = null;
ResultSet rs = null;
Connection conn = null ;
UserInfo ui = null ;
try
{
conn = jc.getConnection() ;
stat = conn.createStatement() ;
rs = stat.executeQuery("select * from manager") ;
while(rs.next())
{
if(rs.getString("name").equals(name)&&rs.getString("password").equals(password))
{
ui = new UserInfo() ;
ui.setUserName(rs.getString("name")) ;
ui.setPassword(rs.getString("password")) ;
ui.setSex(rs.getString("sex")) ;
ui.setAge(rs.getInt("age")) ;
ui.setOName(rs.getString("OName")) ;
ui.setAdress(rs.getString("adress")) ;
ui.setEmail(rs.getString("Emai")) ;
session.setAttribute("name","sd") ;
session.setAttribute("OName","sdsd") ;
%>
<jsp:forward page="goScucessful.jsp"/>
<%
break ;
}
}
if(ui.getAdress()=="")
{
%>
<jsp:forward page="FailToGo.jsp"/>
<%
}
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
rs.close() ;
stat.close() ;
conn.close() ;
}
catch (SQLException e)
{
System.out.println(jc.toString()+"这个数据库资源出现异常没有关闭!") ;
e.printStackTrace();
}
}
%>
</body>
这是我写的传入数据跟数据库中的作比较.然后跳转到相应的界面的代码..但是有问题..麻烦高手给看看.问题如下:
org.apache.jasper.JasperException: /Check.jsp(3,0) Unterminated <%@ page tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:522)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
。。。。。。。。。。
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ page import="com.method.*"%>
<%@ page import="java.sql.*"; %>
<%@ page import="com.conn.*"; %>
这是我的程序的头文件..貌似没什么问题呀..有劳高手哈.. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询