Jun 28, 2012

Struts - How to access Method from your action class to you JSP file.

From you action class
public class YourAction extends ActionSupport{ // NOTE to public this data so you can access in JSP public String name="Winzter"; public String getName() { return this.name; } } // class
From you JSP file.
<c:out value="${action.getName()}" escapeXml="false"></c:out>
If the property name was declare public, you can access by this one.
<c:out value="${name}" escapeXml="false"></c:out>
NOTE:${action.getName()} in only working on Tomcat7.x.x.

No comments: