How to execute method with JSP EL tag?
Till JSP 2.1 by using property name on bean <c:out value=”${beanName.property}”/> we used to display the values, internally it will call getter method of that property and value will be printed to browser. But to execute a normal method which doesn’t have getter method or setter method is not possible till JSP 2.1.
if we write <c:out value=”${beanName.methodName}”/> it will throw an error saying : getMethodName is not existing in type beanName.
But from JSP 2.2 on wards we can write <c:out value=”${beanName.methodName}”/> and it will execute the method internally and outputs the results to browser.
This feature is available in Servlet 3.0 environment, Tomcat 7 implementing Servlet 3.0 so we can run this code in Tomcat 7.
Thanks for reading
Comments (0)
Trackbacks (0)
Leave a comment
Trackback