Pessoal estou tentando usar um bean com java mas nao esta funcionando.
meu jsp:
<%@ page import="beans.*" %>
<HTML>
<HEAD>
<TITLE>Usando Bean</TITLE>
</HEAD>
<BODY>
<% acao m = new acao(); %>
A menssafem e: <%= m.msg() %>
</BODY>
</HTML>
acao.java
package beans;
public class acao{
public acao() {
}
public String msg() {
return "Este e o retorno do metodo";
}
}
e no meu xml esta assim:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!-- Arquivo que inicializa a pasta -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- INICIO - Mapeamento da Bean -->
<servlet>
<servlet-name>acao</servlet-name>
<servlet-class>beans.acao</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>acao</servlet-name>
<url-pattern>beans/acao</url-pattern>
</servlet-mapping>
<!--FINAL - Mapeamento da Bean -->
</web-app>
mas esta dando esse erro:
/usr/java/resin-3.0.14/webapps/becker/WEB-INF/work/_jsp/_bean/_index__jsp.java:9:
package beans does not exist
import beans.*;
^
a bean esta compilada dentro de beans em classes.
abracos