Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

scriptless jsp question  RSS feed

 
John Gregory
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a User class containing a HashMap<String, UserAttr> of their attributes, as represented in our
ldap server. The UserAttr is wrapper class, containing a String name and an ArrayList<String> of values.
Some of the attributes contain only single values, others are multivalued.

Once I do a fetch on the user in my servlet, I set them in a session and forward the request/
response to the displaying jsp. IN that jsp, I want to to display the values of a particular
attribute. At this point, I'm not concerned about printing each value on a separate line, they
can all be on the same one.

For example say I have a user with an attribute called roles with values "DB Admin", "Sr Developer", "Architect".

In my jsp, I do the following:



This gets me the user, as does scripting, but I'm trying not to use scripting. What I want is to display the following on
the page:

Roles [DB Admin, Sr Developer Architect]

How I'm trying to do this is by
The question is can I get the values using either the "dot" operator or the "[]" operator? I've tried various forms
using both, but nothing's done what I'm wanting.

Thanks,

John
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66204
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without telling us excactly what type roles and its values attribute resolve to, it's hard to offer any help.

But, my first inclination would be to add a convenience property to the user class that returns just the list that you want, making it easier to deal with on the JSP. As much as possible, do the heavy lifting in Java code so that the JSPs can be as brain-dead as possible.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!