How to use inside an attribute of <form:input>?

前端 未结 3 1350
南旧
南旧 2021-01-01 10:09

I have JSP code like:

\" path=\"email\" cssClass
相关标签:
3条回答
  • 2021-01-01 10:35

    You can't use a tag inside a tag, simply. You can do something like this,

    <spring:message code="tooltip.text" var="i18nTooltip"/> 
    <form:input id="email_email" name="email_email" title="${i18nTooltip}" path="email" 
                          cssClass="input required email" />
    

    P.S. Better use ${i18nTooltip}, instead of, i18nTooltip, to avoid confusion.

    0 讨论(0)
  • 2021-01-01 10:47
    <spring:message code="tooltip.text" var="variable1"/>
    <form:input id="email_email" name="email_email" title="${variable1}" path="email" 
                          cssClass="input required email" />
    

    You can't use a tag inside an attribute: But you can use the above. It works fine.

    0 讨论(0)
  • 2021-01-01 10:50

    I think this is the most cleaner way to do it :

     <form:input id="email_email" name="email_email" title='<spring:message code="tooltip.text"/>' path="email" cssClass="input required email" />
    

    Look for the changed code being, I have removed double qoutes of title attribut to single qoutes and its works wonders.

    0 讨论(0)
提交回复
热议问题