[ Problema ação JSP ]

Ola pessoa agradeco a atencao! estou com um probleminha quando clico em um botao para excluir a linha da minha tabela aparece esse seguinte erro

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

59: 		
60: 		if (request.getParameter("acao") != null)
61: 		{
62: 		   st.executeQuery("delete from login where codigo ="+request.getParameter("codigo2"));
63: 		}
64: 		
65: 		ResultSet rs = st.executeQuery("select * from login");


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
	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)


root cause 

javax.servlet.ServletException: java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
	org.apache.jsp.usuario_jsp._jspService(usuario_jsp.java:167)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	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)


root cause 

java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
	com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
	com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
	com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
	com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:413)
	com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1297)
	org.apache.jsp.usuario_jsp._jspService(usuario_jsp.java:116)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	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)

Vlw

OBS: codigo2 é meu parametro!

up

Cara, acho que tá faltando aspas simples abrindo e fechando o código…
“…where codigo = '” + request.getParameter(“codigo2”) + “’”

se “codigo” estiver definido como texto na sua base entao falta aspas simples

entao dei uma mudada no codigo mas agora mudo a mensagem de erro eu nao tinha colocado meu Statement isso

Statement st = con.createStatement([b]Resultset.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY[/b]);

inseri mas o erro agora é otro algueim sabe o q pode ser to pesquisando mas n to encontrando nada que possa me ajudar veja o erro

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 58 in the jsp file: /usuario.jsp
Resultset.TYPE_SCROLL_SENSITIVE cannot be resolved to a type
55: 	    Class.forName("com.mysql.jdbc.Driver");
56: 		Connection con = DriverManager.getConnection("jdbc:mysql://localhost/exercicio_jsp","admin", "senha");
57: 
58: 		Statement st = con.createStatement(Resultset.TYPE_SCROLL_SENSITIVE, 
59: 		ResultSet.CONCUR_READ_ONLY);
60: 		
61: 		if (request.getParameter("acao") != null)


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:317)
	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)


algueim ja teve esse tipo de problema !!! obrigado pela atencao! :smiley:

consegui solucionar mudei de executeQuery para executeUpdate e funciono vlw pessoal pela força abraco!