我的代码哪里错了?

问题描述

<%@pagelanguage="java"contentType="text/html;charset=GBK"%><%@pageimport="java.sql.Connection"%><%@pageimport="java.sql.PreparedStatement"%><%@pageimport="entity.Userinfo"%><%@pageimport="dao.BaseDao"%><%@pageimport="java.sql.ResultSet"%><%request.setCharacterEncoding("GBK");Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");Connectionconn=null;PreparedStatementpstmt=null;ResultSetrs=null;BaseDaobasedao=newBaseDao();try{conn=basedao.getConn();Stringsql="select*fromuserinfowhereloginname='"+name+"'"+"andpassword='"+pass+"'";pstmt=conn.prepareStatement(sql);rs=pstmt.executeQuery();if(rs.next()){Userinfoinfo=newUserinfo(name,pass);session.setAttribute("login",info);response.sendRedirect("index.jsp");}else{response.sendRedirect("demologin.html");}}catch(Exceptione){out.println("发生错误")+e.getMessage();}finally{basedao.closeAll(conn,pstmt,rs);}%>提示是第八行错误2009-10-2113:10:02org.apache.catalina.core.StandardWrapperValveinvoke严重:Servlet.service()forservletjspthrewexceptionorg.apache.jasper.JasperException:UnabletocompileclassforJSP:Anerroroccurredatline:8inthejspfile:/login.jspTheleft-handsideofanassignmentmustbeavariable5:<%@pageimport="dao.BaseDao"%>6:<%@pageimport="java.sql.ResultSet"%>7:8:<%9:request.setCharacterEncoding("GBK");10:Stringname=request.getParameter("loginname");11:Stringpass=request.getParameter("password");Anerroroccurredatline:8inthejspfile:/login.jspSyntaxerrorontoken"+",invalidAssignmentOperator5:<%@pageimport="dao.BaseDao"%>6:<%@pageimport="java.sql.ResultSet"%>7:8:<%9:request.setCharacterEncoding("GBK");10:Stringname=request.getParameter("loginname");11:Stringpass=request.getParameter("password");

解决方案

解决方案二:
哪位达人帮忙看看?
解决方案三:
在线等,急求啊。。。
解决方案四:
你把request.setCharacterEncoding("GBK");去掉看看,乱码用newString()进行转换
解决方案五:
%@page%@空格page
解决方案六:
org.apache.jasper.JasperException:UnabletocompileclassforJSP这个报错说明不能够完成类的编译。你好好检查一下使用的JDK之类的都保持一致了吗?同时好好检查一下你的代码,是不是有些逗号、分号之类的使用了中文格式。
解决方案七:
获取密码和用户名是否正确是否对应表单里的文本框名
解决方案八:
语法错误,都不能编译,这样的问题也贴出来!
解决方案九:
去看看你的jsp生成的java文件。
解决方案十:
服务器没问题,别的页面都可以显示,就是这个处理页面不行。。。。
解决方案十一:
引用4楼xiaozhangnima的回复:

%@page%@空格page

不是这个的问题,修改了还是报500错误你把request.setCharacterEncoding("GBK");去掉看看,乱码用newString()进行转换去掉了,也没用。。。。
解决方案十二:
求解求解啊
解决方案十三:
把整页的代码发出来看看啊,这样谁也整不明白啊……
解决方案十四:
Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");之后加判定name和pass是否为null,
解决方案十五:
"'"+"andpassword='"改成"'andpassword='"你写的看着别扭,去了空格,什么异常啊贴全点
解决方案:
路过…………根据你的描述,8行报错,应该是你页面调用类时出的问题。自己再好好检查一下,比如对象声明,连接获取等等。个人建议,像这种编译问题,最好是自己解决,不要放弃,并且在解决的过程中也能获得不少知识,希望你能找到答案。路过…………
解决方案:
<%@pagelanguage="java"contentType="text/html;charset=GBK"%><%@pageimport="java.sql.Connection"%><%@pageimport="java.sql.PreparedStatement"%><%@pageimport="entity.Userinfo"%><%@pageimport="dao.BaseDao"%><%@pageimport="java.sql.ResultSet"%><%request.setCharacterEncoding("GBK");Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");Connectionconn=null;PreparedStatementpstmt=null;ResultSetrs=null;BaseDaobasedao=newBaseDao();try{conn=basedao.getConn();Stringsql="select*fromuserinfowhereloginname='"+name+"'andpassword='"+pass+"'";pstmt=conn.prepareStatement(sql);rs=pstmt.executeQuery();if(rs.next()){Userinfoinfo=newUserinfo(name,pass);session.setAttribute("login",info);response.sendRedirect("index.jsp");}else{response.sendRedirect("demologin.html");}}catch(Exceptione){out.println("发生错误")+e.getMessage();}finally{basedao.closeAll(conn,pstmt,rs);}%>

时间: 2024-09-20 01:03:44

我的代码哪里错了?的相关文章

注册表-VC如何修改浏览器的主页,先帮我看下我的代码哪儿错了

问题描述 VC如何修改浏览器的主页,先帮我看下我的代码哪儿错了 void main() { HKEY hkey1,hkey2; DWORD dwDisposition1,dwDisposition2; RegCreateKeyEx(HKEY_CURRENT_USER,"SoftwareMicrosoftInternet ExplorerMain",0,NULL,0,KEY_ALL_ACCESS,0,&hkey1,&dwDisposition1); RegSetValue

c语言-C 新手请教下面的代码哪里错了?

问题描述 C 新手请教下面的代码哪里错了? e:cato3-1.cpp(1) : error C2628: 'SqStack' followed by 'void' is illegal (did you forget a ';'?) void InitStack(SqStack &S) { if(!(S.base=(SElemType )malloc(STACK_INIT_SIZE*sizeof(SElemType)))) exit(OVERFLOW); S.top=S.base; S.sta

java-大神帮看下我的代码哪里错了?

问题描述 大神帮看下我的代码哪里错了? 题目是编写程序,读入未指定个数的整数,判断读入的正数和负数分别有多少个,然后计算这些输入值的总和及其平均值(不对0计数).当输入为0时,表明程序结束.将平均值以浮点数显示. import java.util.Scanner; public class TextXXXXX { public static void main (String[] args){ Scanner input = new Scanner(System.in); int count1

这段代码哪里错了,一直在报错

问题描述 这段代码哪里错了,一直在报错 Date t = new Date(); long l = t.getTime(); Timestamp time = new Timestamp(l); Connection con = DBUtils.getConnetion(); String sql = ""select * from book_pl group by bookname having pl_date = ? order by avg(book_score) desc&qu

linux下调试程序发现代码走错了路径

问题描述 linux下调试程序发现代码走错了路径 我在linux环境下测试代码,情况如下:有两个工程project_a 和 project_b,project_a是服务进程,project_b是动态库.这两个工程中都存在file.cpp,同时这两个file.cpp中都含有函数func(),我在调试project_b工程的时候函数调用会进入到file.cpp中的func函数中,但是奇怪的是这个时候代码跑到了project_a工程file.cpp中的func函数中.各位大神,谁能解答一下问题的原因到

帮忙看下代码,提示错误:赋值 -- 它是只读的 代码哪里错了?

问题描述 帮忙看下代码,提示错误:赋值--它是只读的代码哪里错了?publicstringgetFileName{get{getFileName="";try{if(((Request==null)==false)){stringwk=Request.Url.LocalPath.ToString();intpos=wk.LastIndexOf("/");if((pos!=-1)){wk=wk.Substring(pos+1);}returngetFileName=w

c语言acm1003 求大神看看我的代码哪错了

问题描述 c语言acm1003 求大神看看我的代码哪错了 Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. Input The first line of the input

opencv 一段代码出错了

问题描述 opencv 一段代码出错了 显示.exe停止工作,但是去掉那个for循环就可以运行,是ptr<>的使用不当吗#include#include#include #include using namespace std;using namespace cv; int main(){ // 读入一张图片 Mat img = imread(""F:/vsprogram/projecttest/01.jpg""); // 创建一个名为 "&q

android开发-一个简单的单击事件监听代码哪里错了?

问题描述 一个简单的单击事件监听代码哪里错了? MainActivity.java package com.example.a007;import android.support.v7.app.ActionBarActivity;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.view.View.OnClic

opencv捕捉视频代码哪儿错了(在书上复制的代码 但报错了)

问题描述 opencv捕捉视频代码哪儿错了(在书上复制的代码 但报错了) -*- coding: utf-8 -*- """ Created on Fri Jan 3 21:06:22 2014 @author: duan """ import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() gray = cv2.cvtCo