• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

scriptless jsp question

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic