Helllo all
I got an issue with dynmically get the messages based on the view's attributeCSV definitons, like teh country example.
here are some of the related setups.
view.properties
[part of the action-servlet.xmlcode]defaultParent.class=org.springframework.web.servle t.view.JstlView
defaultParent.url=/jsp/common/MainTemplate.jsp
defaultParent.requestContextAttribute=rc
underconstruction.attributesCSV=htitle=[app.title],\
content=[underconstruction.content][/code]
MainTemplate.jspCode:<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> <property name="order"><value>0</value></property> <property name="basename"> <value>view</value> </property> <property name="defaultParentView"><value>defaultParent</value></property> </bean> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property> <property name="requestContextAttribute"><value>rc</value></property> <property name="redirectContextRelative"><value>true</value></property> <property name="cache"><value>true</value></property> <property name="prefix"><value>/jsp/</value></property> <property name="suffix"><value>.jsp</value></property> </bean>
the result I expected for the two message tags should be:Code:!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ include file="includes.jsp" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><fmt:message key="htitle"/></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <c:if test="${not empty css}"><link rel="stylesheet" href="<c:url value="${css}"/>" type="text/css" /></c:if> </head> <body> <h1><fmt:message key="app.title"/></h1> <h1><fmt:message key="${htitle}"/></h1> </body> </html>
since app.title is defined as this in the message file.Code:<h1>Spring Test</h1> <h1>Spring Test</h1>
but what I got are:
apparently they tried to use the whole "${htitle}" to get the message.Code:<h1>Spring Test</h1> <h1>???${htitle}???</h1>
I did not see any difference of this app and the country example except that the jsps in this app are not in the web-inf dir. I assume this should not make a big difference here.
Thanks a lot for your help.
jfd


Reply With Quote