Olá pessoal!
Sou novo em desenvolvimento com Java e encontrei um problema no caminho que não consigo resolver.
Eu tenho um aplicativo rodando num servidor Windows, com apache-tomcat 5.5 e BD MySQL.
Preciso migrar para linux, então baixei o ubuntu, instalei a estrutura necessária (apache, tomcat 6.0, MySQL) e somente copiei a pasta com o aplicativo do Webapps do window para o Webapps do Linux, além é claro de copiar o banco de dados.
Consigo acessar as primeiras páginas, mas tem uma que dá o seguinte erro:
org.apache.jasper.JasperException: An exception occurred processing JSP page /cadastro/usuarios.jsp at line 7
4: <jsp:useBean id="usuario" scope="page" class="cadastro.Usuario" />
5: <jsp:setProperty name="usuario" property="*" />
6: <%if (request.getSession().getAttribute("logado") == "ok"){ %>
7: <logic:equal parameter="acao" value="incluir">
8: <script>alert('<jsp:getProperty name="usuario" property="incluir"/>');
9: window.location.replace('usuarios.jsp');
10: </script>
Lembrei que não tinha instalado o Framework Struts, então fui lá e instalei, mas mesmo assim continua dando o mesmo erro.
Já procurei bastante aqui no fórum e mesmo seguindo as dicas de setar a o CLASSPATH para apontar para o struts.jar, mas nada adianta.
Alguem pode me dar uma luz?????
Segue abaixo o código que está dando erro:<%@page contentType="text/html; charset=ISO-8859-1"%>
<%@taglib uri="../WEB-INF/lib/struts-logic.tld" prefix="logic"%>
<%@include file="../autentica.jsp"%>
<jsp:useBean id="usuario" scope="page" class="cadastro.Usuario" />
<jsp:setProperty name="usuario" property="*" />
<%if (request.getSession().getAttribute("logado") == "ok"){ %>
<logic:equal parameter="acao" value="incluir">
<script>alert('<jsp:getProperty name="usuario" property="incluir"/>');
window.location.replace('usuarios.jsp');
</script>
</logic:equal>
<logic:equal parameter="acao" value="alterar">
<script>alert('<jsp:getProperty name="usuario" property="alterar"/>');
window.location.replace('usuarios.jsp');
</script>
</logic:equal>
<logic:equal parameter="acao" value="alterarproprio">
<script>alert('<jsp:getProperty name="usuario" property="alterarproprio"/>');
window.location.replace('usuarios.jsp');
</script>
</logic:equal>
<logic:equal parameter="acao" value="excluir">
<script>alert('<jsp:getProperty name="usuario" property="excluir"/>');
window.location.href="usuarios.jsp";
</script>
</logic:equal>
<%} else { %>
<script>
alert('Esta sesso no mais vlida. Favor efetuar novo login.');
window.location.replace('../index.jsp');
</script>
<%} %>
<html>
<head>
<link rel="stylesheet" href="../intranet.css" type="text/css">
<title>Intranet</title>
</link>
</head>
<script language="javascript">
//rotina para inserir no select/option
function carrega(){
document.form1.reset();
var usuariosXML="";
if (window.ActiveXObject){
var usuariosXML = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument){
var usuariosXML=document.implementation.createDocument("","",null);
}
usuariosXML.async= false;
usuariosXML.load("../buscamatricula");
var tam = usuariosXML.getElementsByTagName("matricula");
for (x = 0; x <= tam.length-1; x++){
var codigo = usuariosXML.getElementsByTagName("matricula")[x].firstChild.nodeValue;
var selmatricula = document.getElementsByName("slcMatricula")[0];
var adicionar = document.createElement("option");
adicionar.value = codigo;
adicionar.innerHTML = codigo;
selmatricula.appendChild(adicionar);
}
}
function trocadados(valor, indice){
var dadosXML="";
if (window.ActiveXObject){
var dadosXML = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument){
var dadosXML=document.implementation.createDocument("","",null);
}
if (indice >= 2){
dadosXML.async= false;
dadosXML.load('../buscausuario?slcMatricula='+valor);
document.form1.txtMatricula.value = dadosXML.getElementsByTagName("matricula")[0].firstChild.nodeValue;
document.form1.txtFuncionario.value = dadosXML.getElementsByTagName("funcionario")[0].firstChild.nodeValue;
document.form1.txtAdmin.value = dadosXML.getElementsByTagName("admin")[0].firstChild.nodeValue;
} else{
document.form1.txtMatricula.value = '';
document.form1.txtFuncionario.value = '';
document.form1.txtAdmin.value = '';
}
}
function trocaacao(){
if (document.form1.slcMatricula.selectedIndex== 1){
document.form1.action = "usuarios.jsp?acao=incluir";
} else {
document.form1.action = "usuarios.jsp?acao=alterar";
}
}
function teclaSpace(campo, teclaPress) {
if(teclaPress.keyCode == 32){
alert('No use espaos');
vr = document.form1[campo].value;
vr = vr.replace(" ", "" );
document.form1[campo].value = vr;
return false;
}
}
function pass(){
psw = document.getElementById("passw");
var senhaXML="";
if (window.ActiveXObject){
var senhaXML = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument){
var senhaXML=document.implementation.createDocument("","",null);
}
if (document.form1.slcMatricula.selectedIndex==1){
psw.style.display = "block";
inputpass.innerHTML = "<input maxlength='8' type='password' onkeyup='valor();' id='txtSenha' name='txtSenha' style='width: 68px;'>";
valor();
} else if (document.form1.slcMatricula.value == '<%=session.getAttribute("matricula")%>'){
senhaXML.async= false;
senhaXML.load('../buscasenha?slcMatricula=<%=session.getAttribute("matricula")%>');
var senha = senhaXML.getElementsByTagName("codigo")[0].firstChild.nodeValue
psw.style.display = "block";
inputpass.innerHTML = "<input maxlength='8' onkeyup='valor();' type='password' id='txtSenha' name='txtSenha' value='"+senha+"' style='width: 68px;'>";
document.form1.action = "usuarios.jsp?acao=alterarproprio";
valor();
} else {
psw.style.display = "none";
}
}
function obrigatorios(){
matricula = document.form1.txtMatricula.value;
nome = document.form1.txtFuncionario.value;
ex = document.getElementById("passw");
admin = document.form1.txtAdmin;
var usuarios2XML="";
var respXML = "";
if (window.ActiveXObject){
var usuarios2XML = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument){
var usuarios2XML=document.implementation.createDocument("","",null);
}
if (document.form1.slcMatricula.value == "0"){
alert('Selecionar Incluso ou Alterao de Usurio.');
document.form1.slcMatricula.focus();
return false;
}
if (matricula.length <= 7){
alert('Informar a Matricula com 8 dgitos.');
document.form1.txtMatricula.focus();
return false;
}
if (nome.length <= 1){
alert('Informar o nome completo.');
document.form1.txtFuncionario.focus();
return false;
}
senha = document.getElementById("txtSenha");
senhav = senha.value;
if (senhav.length <= 7){
alert('Informar a Senha com 8 dgitos.');
senha.focus();
return false;
}
if(isNaN(senha.value)){
alert('Informar somente nmeros!')
document.form1.txtSenha1.value= '';
senha.value= '';
senha.focus();
return false;
}
if (admin.value == ""){
alert('Informar Status do Usurio.');
document.form1.txtAdmin.focus();
return false;
}
if(document.form1.action == "usuarios.jsp?acao=incluir" || document.form1.action == "usuarios.jsp?acao=alterar" && matricula != document.form1.slcMatricula.value){
var mat = document.form1.txtMatricula.value;
usuarios2XML.async= false;
usuarios2XML.load('../buscausuario?slcMatricula='+mat);
if ((usuarios2XML.getElementsByTagName("dados")[0].firstChild) != null){
respXML = usuarios2XML.getElementsByTagName("matricula")[0].firstChild.nodeValue;
}
if ((document.form1.txtMatricula.value).toUpperCase() == respXML ){
alert('Usurio j Cadastrado');
document.form1.txtMatricula.focus();
document.form1.txtMatricula.value='';
return false;
}
}
}
function valor(){
senha = document.getElementById("txtSenha");
document.form1.txtSenha1.value = senha.value;
}
</script>
<body topmargin="0" leftmargin="0" onload="carrega();">
<XML ID="usuariosXML"></XML>
<XML ID="usuarios2XML"></XML>
<XML ID="dados"></XML>
<XML ID="senhaXML"></XML>
<table width="778" bgcolor="#FEF259" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<table width="778" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="42" valign="middle" align="center"><a
href="http://intranet.bb.com.br" target="_parent"> <img
src="../img/logo.gif" border="0" width="28" height="28"></a></td>
<td valign="top" width="389" height="46">
</table>
</td>
</tr>
</table>
<table width="778" bgcolor="#090F5F" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<table width="778" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="26">
</tr>
</table>
</td>
</tr>
</table>
<table width="778" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="190" valign="top">
<table width="190" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="294" valign="top" bgcolor="#E6F0FD" width="190"><%@include
file="../menu.jsp"%></td>
</tr>
</table>
</td>
<td valign="top">
<table width="588" border="0" cellpadding="0" cellspacing="0">
<form name="form1" id="form1" action="" method="post" onsubmit="return obrigatorios();">
<tr>
<td width="20"> </td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="titulo"> </td>
</tr>
<tr>
<td width="100%" class="titulo"><img border="0"
src="../img/setaAzul.gif" width="10" height="10"> Cadastro de
Usurios</td>
</tr>
<tr>
<td width="100%" class="titulo"> </td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="147">
<p align="right"> <font size="2">Usurios:</font>
</td>
<td><select size="1" style="width:140" name="slcMatricula"
onchange="trocadados(this.value, this.selectedIndex); trocaacao(); pass();">
<option selected value="0">Selecionar ou Adicionar</option>
<option value="incluir" style="background: #A6CBF0;">Adicionar Usurio</option>
</select></td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="500">
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="147" align="right"><font size="2">N Matrcula:</font>
</td>
<td><input style="width:68" name="txtMatricula" maxlength="8"
id="txtMatricula" onkeyup="teclaSpace(this.name, event); valor();"></input></td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="147" align="right"><font size="2">Nome:</font></td>
<td><input maxlength="50" style="width:200" name="txtFuncionario"
id="txtFuncionario" ></input></td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%"><input name="txtSenha1" type="hidden"></input>
<table style="display: none;" border="0" cellpadding="0" cellspacing="0" width="400" id="passw">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="147" align="right"><font size="2">Senha:</font></td>
<td id="inputpass"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="147" align="right"><font size="2">Administrador</font></td>
<td><select size="1" name="txtAdmin" id="txtAdmin"
>
<option selected value="">-----</option>
<option value="S">Sim</option>
<option value="N">No</option>
</select></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" align="left">
<tr>
<td width="147"> </td>
<td><input type="submit" onclick="return obrigatorios();"
value="Gravar"></input></td>
<td><input type="button"
onclick="form1.action='usuarios.jsp?acao=excluir'; document.form1.submit();"
value="Excluir"></input></td>
<td><input type="button" value="Ajuda" name="btnAjuda"></input></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
Agradeço a colaboração!