简体   繁体   English

Spring中没有加载Spring消息

[英]Spring message don't load in JSP

I have a JSP that loads another JSP that contains a XSLT transformation. 我有一个JSP加载另一个包含XSLT转换的 JSP

JSP:1 JSP:1

...
<div id="main_div">
      <-- load here -->
</div>

and in javascript I made a call $('#main_div').load('page_name.htm', ... 在javascript中我拨打了电话$('#main_div').load('page_name.htm', ...

which goes to MVC Controller , return the JSP:2 url that is loaded on main_div . 转到MVC Controller ,返回在main_div上加载的JSP:2 url

JSP:2 contains only the XLST call JSP:2仅包含XLST调用

    <c:set var="xmltext">
        ${form.xmlResponse}
    </c:set>
    <c:import url="template.xsl" var="xslt"/>
    <x:transform xml="${xmltext}" xslt="${xslt}"/>

This call provides XML to XSLT, in order to return HTML code. 此调用为XSLT提供XML,以便返回HTML代码。

XML XML

<a>
  ...
  <country>EN</country>
  ...
</a>

Using <spring:message code="table_country_code.EN"/> tag, choose based on the browser language, the transalation into England, Inglaterra, etc... 使用<spring:message code="table_country_code.EN"/>标签,根据浏览器语言选择,转换为英格兰,Inglaterra等...

XSLT: XSLT:

<spring:message xmlns:spring="http://www.springframework.org/tags" code="table_country_code.{country}"/>

The problem is that I want to use spring:message in order to translate some fields through an i18n table, and the XSLT can produce me the tag , but don't convert the tag into the message of this code (ie, the output in JSP/HTML is <spring:message code="table_country_code.EN"/> instead of England) 问题是我想使用spring:message来通过i18n表转换某些字段,而XSLT可以生成标签,但不要将标签转换为此代码的消息(即输出中的JSP / HTML<spring:message code="table_country_code.EN"/>而不是英格兰)

Any idea why? 知道为什么吗?

If you have <spring:message code="table_country_code.EN"/> instead of England it seems to me that your tag isn't parsed at all. 如果你有<spring:message code="table_country_code.EN"/>而不是英格兰,那么在我看来你的标签根本就没有解析过。 Maybe you've missed the import of spring in your JSP ? 也许你错过了JSP中spring的导入?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM