I'm migrating a Java Web Application using regular Servlets to Struts2 Actions.
I can't seem to be able to access the Action objects on the JSP using JSTL tags. The tags were working correctly before the migration, but now they just show the variable name. I can, however, access the object with Struts2 tags, so i'm not sure what the problem is with JSTL.
My Action has the following object:
private String prueba = "hola";
public String getPrueba() {
return prueba;
}
public void setPrueba(String prueba) {
this.prueba = prueba;
}
On the JPS:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
This tag shows "${prueba}" on the screen.
<c:out value="${prueba}" />
While this tag correctly shows "hola".
<s:property value="prueba"/>
I have the latest version of JSTL library on my classpath, and no errors are shown on the console, so I'm not sure what could be the problem. Do I need to configure something else, either on struts.xml, web.xml or my Action class?
Thanks in advance.
UPDATE:
My struts.xml
<struts><!-- Configuration for the default package. -->
<package name="default" namespace="/" extends="struts-default">
<action name="listaAutos"
class="com.neoris.training.lab.autos.negocios.AutomovilServlet"
method="service">
<result name="success">/listaautos.jsp</result>
</action>
</package>
</struts>
My web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Team1PrjStruts</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
FilterDispatcher
(that is deprecated since 2.1.3) toStrutsPrepareAndExecuteFilter
– Andrea Ligios Jan 10 '14 at 9:12