This spring message tag will display the property value of the samples.title.dialog variable on the page:
<spring:message code="samples.title.dialog" text="samples.title.dialog"/>
This div tag only shows the literal string "samples.titl开发者_如何学编程e.dialog" on the page.
<div id="dialog" title="samples.title.dialog">
How do I use the value of the variable samples.title.dialog as the title of my div tag? When I use the EL expression ${samples.title.dialog} as the title attribute it shows blank on the page.
I'm trying to use a div tag like this:
<div id="dialog" title="${samples.title.dialog}">
Use an EL expression:
<spring:message code="samples.title.dialog" text="${samples.title.dialog}"/>
UPDATE #1:
I think you might be referring to an attribute named samples.title.dialog
associated with one of the four scopes: application, request, session or page. Try one of these:
<spring:message code="samples.title.dialog" text="${applicationScope['samples.title.dialog']}"/>
<spring:message code="samples.title.dialog" text="${requestScope['samples.title.dialog']}"/>
<spring:message code="samples.title.dialog" text="${sessionScope['samples.title.dialog']}"/>
<spring:message code="samples.title.dialog" text="${pageScope['samples.title.dialog']}"/>
UPDATE #2:
It looks like you're actually trying to use a value defined in a Spring Internationalization properties file. Check out this Spring Internationalization example and verify that you've done all the steps correctly to wire things up.
<spring:message code="samples.title.dialog" var="i18n_dialog" />
${i18n_dialog}
Note: You can't do this, because samples.title.dialog is a read-only property:
<spring:message code="samples.title.dialog" var="samples.title.dialog" />
精彩评论