67,549
社区成员




怎么做啊,啊啊啊啊
[quote=引用 5 楼 a229397620 的回复:]
[quote=引用 4 楼 maradona1984 的回复:]
断点下org.springframework.web.servlet.tags.MessageTag 也是可以的
{{each data as p_permission}}
{{if (p_permission.pid==null)}}
<li class="m" style="width:12%"><span class="icon-hamburg-bank" style="margin-right: 20px"></span>
<a href="#" value="{{p_permission.id }}" name="menu_a" class="mmm" style="width:100%">
<span class="t-btn-top t-btn-icon-top"><span class="t-btn-text" style="color:#cedae6;font-size:15px;"><strong>{{p_permission.name}}</strong></span><span class="t-btn-icon {{p_permission.icon }}"> </span></span>
</a>
</li>
{{/if}}
{{/each}}
[quote=引用 4 楼 maradona1984 的回复:] 断点下org.springframework.web.servlet.tags.MessageTag 也是可以的
{{each data as p_permission}}
{{if (p_permission.pid==null)}}
<li class="m" style="width:12%"><span class="icon-hamburg-bank" style="margin-right: 20px"></span>
<a href="#" value="{{p_permission.id }}" name="menu_a" class="mmm" style="width:100%">
<span class="t-btn-top t-btn-icon-top"><span class="t-btn-text" style="color:#cedae6;font-size:15px;"><strong>{{p_permission.name}}</strong></span><span class="t-btn-icon {{p_permission.icon }}"> </span></span>
</a>
</li>
{{/if}}
{{/each}}
这是页面的菜单遍历写法,菜单名称{{p_permission.name}}是这样获取,<spring:message code="" />code应该如何填写呢,我尝试了各个方式也不行[/quote]
...你这遍历是js模版吧...大兄弟
啥是前端执行啥是后端执行你都没整清楚吗?
用jstl遍历吧,spring的国际化都是后端渲染的,如果你真想前端渲染,那就换个前端的国际化组件,spring的自定义标签是支持el表达式传入参数的
我们的项目这种国际化处理的数据都是写在xml文件中的,有英文,中文,香港(繁体)
断点下org.springframework.web.servlet.tags.MessageTag 也是可以的
{{each data as p_permission}}
{{if (p_permission.pid==null)}}
<li class="m" style="width:12%"><span class="icon-hamburg-bank" style="margin-right: 20px"></span>
<a href="#" value="{{p_permission.id }}" name="menu_a" class="mmm" style="width:100%">
<span class="t-btn-top t-btn-icon-top"><span class="t-btn-text" style="color:#cedae6;font-size:15px;"><strong>{{p_permission.name}}</strong></span><span class="t-btn-icon {{p_permission.icon }}"> </span></span>
</a>
</li>
{{/if}}
{{/each}}
<tag>
<description>
Retrieves the message with the given code, or text if code isn't resolvable.
The HTML escaping flag participates in a page-wide or application-wide setting
(i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml).
</description>
<name>message</name>
<tag-class>org.springframework.web.servlet.tags.MessageTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>A MessageSourceResolvable argument (direct or through JSP EL).
Fits nicely when used in conjunction with Spring's own validation error
classes which all implement the MessageSourceResolvable interface. For
example, this allows you to iterate over all of the errors in a form,
passing each error (using a runtime expression) as the value of this
'message' attribute, thus effecting the easy display of such error
messages.</description>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>The code (key) to use when looking up the message.
If code is not provided, the text attribute will be used.</description>
<name>code</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Set optional message arguments for this tag, as a
(comma-)delimited String (each String argument can contain JSP EL),
an Object array (used as argument array), or a single Object (used
as single argument). You can additionally use nested spring:argument
tags.</description>
<name>arguments</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>The separator character to be used for splitting the
arguments string value; defaults to a 'comma' (',').</description>
<name>argumentSeparator</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Default text to output when a message for the given code
could not be found. If both text and code are not set, the tag will
output null.</description>
<name>text</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>The string to use when binding the result to the page,
request, session or application scope. If not specified, the result
gets outputted to the writer (i.e. typically directly to the JSP).</description>
<name>var</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>The scope to use when exporting the result to a variable.
This attribute is only used when var is also set. Possible values are
page, request, session and application.</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Set HTML escaping for this tag, as boolean value.
Overrides the default HTML escaping setting for the current page.</description>
<name>htmlEscape</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Set JavaScript escaping for this tag, as boolean value. Default is false.</description>
<name>javaScriptEscape</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>