Search code examples
javajavascripthtmljspstruts

Set button title to bean message in a JSP


I have a JSP question for you that I've been googling... I am using a title tag to display a long sentence on hover. However I want to put the sentence in a bean message and therefore set the title property equal to a bean message for example: Define message in struts-resources as…. My.hover_description = “blah blah blah and more blah”

JSP code:

<TD>
<html:button title= "<bean:message key=" My.hover_description "/> "
</html:button>
</TD>

I also tried but I think it’s just taking my quote as literal text rather than code:

<TD>
<html:button title= '<bean:message key=" My.hover_description "/>'
</html:button>
</TD>

So I’m wondering if I have to escape the quotes like so /” /” at the beginning and end of title definition or is there another way to escape the characters?


Solution

  • TD>
    <input type="button" title='<bean:messagekey="My.hover_description"/>'
    class="myClass" value='My Button'>
    </TD>
    

    This is the easy way...