Announcement Announcement Module
No announcement yet.
Adding an attribut to a tag in a generic way Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding an attribut to a tag in a generic way


    in a small to mid-size spring mvc web application i want to add a title attribute to most of the label tags.
    The label-captions are retrieven from a message-source as the title values should be also.
    So one way would be to hard-code the title attribute in every jsp. But this would lead to much redundant code (and work) since for every label some lines of code are needed, because the value form the message source has to be assigned to a variable first since there seems to no way to get the text from the message soure directly into the title value.

    So i came up with the idea to let do this work by some java class. But since i am newbie to spring i didnt know where to start.
    So i ended up with overwriting org.springframework.web.servlet.tags.form.LabelTag .writeTagContent method.
    This might be a possible way, but i dont think that this could be the correct way.

    So my question is:

    What could be the right way to add an attribut to a tag in a gerneric way, for example extending the class hierachy or writing a sort of filter class.

    Thanks in advance.


    Sitemesh is also used in this application, but i didnt find a way to do this with sitemesh. If there is some, this would be a good solution too.