• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using EL with Array  RSS feed

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a JSP which simply list out all the application scope attributes and its class type. Recall that we have 'Object.getClass()' returning a 'Class' object which in turn has a 'Class.getName()' returning the name of the class. So this EL should list the class type of ANY object 'obj':

${obj.class.name}

But, if obj is an array - which is just an object - the above syntax doesnt seem to work (at least in tomcat) because EL expects array must have index rather than property. So this must be used:

${obj[2]...}

So what would be the correct way to get the class type name for array using EL?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!