Question

I have a decorator specified on a displaytag table that I need to pass parameters to. The decorator adds an id attribute to the row. Currently the values I require are hardcoded.

The parameters I need are:

  • The name of the property to use as id value
  • An id prefix (usually the property used is a number and IE doesn't like ids starting with numbers)

Looking through the javadocs for displaytag, it looks like I can set a property (<displaytag:setProperty>), but there doesn't seem to be a way for me to return a general property.

Was it helpful?

Solution

Decorators have access to the PageContext. You can pass parameters as its attributes (for example, using <c:set .../>).

OTHER TIPS

Maybe you can provide a little bit more of info? Show us your decorator implementation pls.

If I got you right: You need the id of the iterated property? If you implement the

DisplaytagColumnDecorator

Interface, you can access the iterated property by

decorate(java.lang.Object columnValue, javax.servlet.jsp.PageContext pageContext, MediaTypeEnum media) 

where columValue is your property object for each row.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top