Jump to content
Fórum Script Brasil
  • 0

Ajuda Com Jsp, Por Favor!


neo_soro
 Share

Question

boa noite! venho aqui pedir uma ajuda para vocês, por favor. estou tendo um grande problema e não sei onde está esse erro. não sei se posso postar esse dúvida aqui, mas aí vai. se puderem me ajudem, por favor.

estou tentando simplesmente cadastrar um cliente em uma tabela e está dando o seguinte erro:

500 Servlet Exception

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

at com.caucho.loader.DynamicClassLoader.findClass(DynamicClassLoader.java:1180)

at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1119)

at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1068)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at _jsp._jsp._cadastra__jsp._jspService(JSP/conn.jsp:5)

at com.caucho.jsp.JavaPage.service(JavaPage.java:61)

at com.caucho.jsp.Page.pageservice(Page.java:578)

at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:192)

at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:175)

at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240)

at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)

at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481)

at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685)

at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607)

at java.lang.Thread.run(Thread.java:619)

os arquivos são:

cadastro.jsp

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<html>

<head>

<title>Cadastro</title>

</head>

<body>

<form id="form1" name="form1" method="post" action="cadastra.jsp">

<input name="txtId" type="hidden" id="id" /><br />

<label>Nome:

<input name="txtNome" type="text"/>

</label>

<label><br />

<label>Telefone:

<input name="txtTel" type="text"/>

</label>

<br />

<label>E-mail:

<input name="txtEmail" type="text"/>

</label>

<br />

<br />

<input type="submit" name="Submit" value="Submit" />

</form>

<a href="">Listar</a>

</body>

</html>

e cadastra.jsp

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>

<%@include file="conn.jsp"%>

<%

//Nada será gravado no cache do cliente

response.setDateHeader("Expires", 0);

response.setHeader("Pragma", "no-cache");

if (request.getProtocol().equals( "HTTP/1.1" )) {

response.setHeader("Cache-Control","no-cache");

}

%>

<%

out.println("<html><head><script language='JavaScript'>");

try{

stm.executeUpdate("insert into cliente(idCliente,nmCliente,telCliente,emailCliente) values('"+ request.getParameter("txtId") +"','"+ request.getParameter("txtNome") +"','"+ request.getParameter("txtTelefone") +"','"+ request.getParameter("txtEmail") +"');");

}finally{

out.println("history.go(-1);");

out.println("</SCRIPT></head><body></body></html>");

}

%>

e o arquivo de conexão conn.jsp

<%@ page language="java" import="java.sql.*" %>

<%

Class.forName("com.mysql.jdbc.Driver");

Connection con = DriverManager.getConnection("jdbc:mysql://localhost/chjm","root","");

Statement stm = con.createStatement();

%>

eu uso o resin como servidor web e já instalei o mysql_connector na pasta lib... o que será que está errado?

desde já agradeço, neoSoro.

Edited by neo_soro
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.1k
    • Total Posts
      647k
×
×
  • Create New...