• Post Reply Bookmark Topic Watch Topic
  • New Topic

How are JSP tags mapped to Java functions?

 
Rob Wehrstein
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to understand the composite expressions example that is sometimes installed along with Tomcat7. The JSP file, composite.jsp, includes the following lines:

The associated java files, ValuesBean.java and ValuesTag.java, contain functions such as

Nowhere are there references to either the setter or getter functions. How is the information in the JSP tag mapped to the actual Java functions?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A .tld file maps tags to their definitions.
 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand correctly you are asking how does ${values.doubleValue} or <jsp:setProperty name="values" property="doubleValue"> get mapped to the method getDoubleValue() in ValuesBean

That is defined by the JavaBeans specification - which among other things defines how a property maps to a getter/setter method via naming convention.
Both the EL and the standard JSP tags leverage that standard rather than writing its own.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!