Uso o net beans e mysql. A parte de cadastro ta funcionando blz
só na pesquisa pelo nome que cadastrei que não
da esse erro The requested resource () is not available. 404
será que o net beans está com problemas?
será as variáveis de ambiente configuradas erradas?
como configurar corretamente as variáveis de ambiente?Uso o XP
na escola funciona normal mas aqui em casa não
ProdutoWeb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action = "produtos.jsp" method = "post">
Produto <input type = "text" name="produto"/><br>
Valor da compra <input type = "text" name="valorcompra"/><br>
Lucro <input type = "text" name="lucro"/><br>
Quantidade de estoque<input type = "text" name = "quantidadeestoque"/><br>
Quantidade mínima <input type = "text" name="quantidademinima"/><br>
<input type ="submit" name = "ok" value ="cadastrar"/>
<a href= pesquisarWeb.jsp> pesquisar</a>
</form>
</body>
</html>
produto.jsp
<%@ include file="conexao.jsp" %>
<%
//scriptlets
String Produto = request.getParameter("produto");
String QuantidadeMinima = request.getParameter("quantidademinima");
String QuantidadeEstoque = request.getParameter("quantidadeestoque");
String Lucro = request.getParameter("lucro");
String ValorCompra = request.getParameter("valorcompra");
String sql = "insert into produto (produto,valorcompra,quantidadeestoque,lucro,quantidademinima)" +
" values('"+Produto+"','"+QuantidadeMinima+"','"+QuantidadeEstoque+"','"+Lucro+"','"+ValorCompra+"')";
stm.execute(sql);
%>
PesquisaWeb
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pesquisar</title>
</head>
<body style ="background:silver;">
<center>
<h3>Escolha uma forma de pesquisar inserindo um valor no campo respectivo</h3>
<form name =" form1" method ="post" action ="pesquisa.jsp">
<table>
<tr>
<td>Nome:</td>
<td><input type = "text" name = "produto"></td>
</tr>
<tr>
<td><input type = "submit" value = "pesquisar"></td>
<td><input type = "button" value = "Voltar" onclick = "history.go(-1)"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
pesquisa.jsp
<%@ include file="conexao.jsp" %>
<html>
<head>
<title> Pesquisar </title>
</head>
<body style = "background-color:silver;">
<p><center>Dados da Pesquisa</center>
<table border = "1" align = "center" bordercolor = "blue">
<tr>
<td>produto</td>
<td>Valor da compra</td>
<td>quantidade no estoque</td>
<td>quantidade minima</td>
</tr>
<%
//String tipo = request.getParameter("forma");
//variaveis que receberão algum valor como parametro vindo da pagina pesquisar
String Produto = request.getParameter("produto");
//variaveis que receberão os valores do banco de dado
String ValorCompra;
String QuantidadeEstoque;
String Lucro;
String QuantidadeMinima;
if(Produto != ""){
ResultSet rs = stm.executeQuery("select * from demanda where produto = '" +Produto+"'");
while(rs.next()){
Produto = rs.getString("produto");
ValorCompra = rs.getString("valorcompra");
QuantidadeEstoque = rs.getString("quantidadedeestoque");
Lucro = rs.getString("lucro");
QuantidadeMinima = rs.getString("quantidademinima");
%>
<tr>
<td><% out.println( Produto); %></td>
<td><% out.println(ValorCompra); %></td>
<td><% out.println(QuantidadeEstoque); %></td>
<td><% out.println(Lucro ); %></td>
<td><% out.println(QuantidadeMinima); %></td>
</tr>
<%
}//fecha o while
}//fecha o if
%>
</table>
<input type = "button" value = "Voltar" onclick = "history.go(-1)">
</body>
</html>
Conexao.Jsp
<%@ page import ="java.sql.*" %>
<%
Class.forName("com.mysql.jdbc.Driver");
//carrega o driver
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/loja","root","root");
//pega o id da conexao depois de ler a string de conexao
Statement stm = con.createStatement();
//inicializar o ponteiro no banco
%>
Ele cadastra normal somente na hora de pesquisar o que cadastrei que ele da esse erro
type Status report
message
descriptionThe requested resource () is not available.