spring jvc model value with jsp tags(spring mvc model value with jsp tags)
这就是我所拥有的:我在jsp页面中使用JTable( http://www.jtable.org/ )以及spring mvc模型。 我也有设置本地化,所有这些工作正常。 下面我有我的部分代码,添加了我认为相关的内容,因为我不确定...请在我得到一些输入后立即问我(将在周一回答,因为在周末,我可以通过电脑访问) 。
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="classpath:i18n/messages"/> <property name="defaultEncoding" value="UTF-8"/> </bean> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"> <property name="paramName" value="lang"/> </bean> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"> <property name="defaultLocale" value="en_US"/> </bean>
这是我需要做的:我需要创建一个jtable,其中字段,操作等来自服务器,以便它们是动态的(检查动态创建由其他用户制作的jQuery-jTable的多级Javascript对象 )。 在我的情况下,myobj将来自服务器作为字符串,即
@RequestMapping(value = "/locales", method = RequestMethod.GET) public ModelAndView testList(ModelAndView mv, final HttpServletRequest request) { mv.setViewName("list"); mv.addObject("model", "{\n" + " title: '<spring:message code=\"table.users.users\"/>',\n" + .... " fields: {\n" + " ID: {\n" + " key: true,\n" + " list: false,\n" + " create: false,\n" + " edit: false\n" + " },\n" + " Name: {\n" + " title: '<spring:message code=\"table.name\"/>',\n" + " width: '15%',\n" + ...
您在控制器模型中传递的上述文本将动态创建(使用速度引擎,动态数据......)
list.jsp如下:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %> <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> <tags:template> <jsp:body> <script> $(document).ready(function() { $('#ListContainer').jtable(${model}); $('#ListContainer').jtable('load'); }); </script> <div id="ListContainer" style="width:99%;"></div> </jsp:body> </tags:template>
我的问题是,虽然我在我的网站设置本地化等等,但是当这些标记位于控制器返回模型的内容中时,它们不会被渲染。 有没有办法对Controller或InternalResourceViewResolver说出解决模型的值,好像它是一个jsp?
我希望我能清楚地解决问题并提供回复我所需的一切,如果没有,请随意提问。 我担心,因为我仍然倾向于我没有清楚在我的脑海里如何所有这些绑定我唯一知道的是我需要有一个动态/通用jtable列表完全本地化列表。
Here is what i have: I am using JTable (http://www.jtable.org/) inside jsp pages, along with spring mvc model. I also have setup localization, all these work fine. Below i have part of my code, added what i consider as relevant as i am not sure... Please ask me as soon as you get some input for me (will answer on monday as in weekend i doupt i can have pc access).
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="classpath:i18n/messages"/> <property name="defaultEncoding" value="UTF-8"/> </bean> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"> <property name="paramName" value="lang"/> </bean> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"> <property name="defaultLocale" value="en_US"/> </bean>
Here is what i need to do: I need to create a jtable where fields, actions,etc come from server so that these are dynamic (check Dynamic creation of multilevel Javascript object for jQuery-jTable made from other user). In my case myobj will come from server as a string, i.e.
@RequestMapping(value = "/locales", method = RequestMethod.GET) public ModelAndView testList(ModelAndView mv, final HttpServletRequest request) { mv.setViewName("list"); mv.addObject("model", "{\n" + " title: '<spring:message code=\"table.users.users\"/>',\n" + .... " fields: {\n" + " ID: {\n" + " key: true,\n" + " list: false,\n" + " create: false,\n" + " edit: false\n" + " },\n" + " Name: {\n" + " title: '<spring:message code=\"table.name\"/>',\n" + " width: '15%',\n" + ...
This text you see above passed in the model of the controller will be created dynamically (using velocity engine,dynamic data,...)
list.jsp is as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %> <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> <tags:template> <jsp:body> <script> $(document).ready(function() { $('#ListContainer').jtable(${model}); $('#ListContainer').jtable('load'); }); </script> <div id="ListContainer" style="width:99%;"></div> </jsp:body> </tags:template>
My problem is that although i have in my site setup localization et all, the tags i.e. ' are not rendered when these are inside the content of the controller's returned model. Is there a way to say to the Controller or the InternalResourceViewResolver to resolve the model's value as if it was a jsp?
I hope i made my problem clear and gave all that is needed to respond to me, if not please feel free to ask. I am afraid since i am still leaning i do not have either clear in my mind how all these bind together the only thing i know is that i need to have a dynamic/generic jtable list fully localized list.
原文:https://stackoverflow.com/questions/24329160
满意答案
这些设置不会影响任何事情。 它们是标准化的logstash字段,可用于轻松报告源自多个源的日志。
它们只是一个logstash约定而不是弹性搜索约定。
Those settings do not affect anything. They are standardised logstash fields which are used so you can easily report on logs originating from multiple sources.
They are just a logstash convention and not an elasticsearch convention.
相关问答
更多Elasticsearch词组前缀查询多个字段(Elasticsearch phrase prefix query on multiple fields)
前缀 - 这意味着什么(prefixed - what does this means)
ElasticSearch字段前缀为“@”(ElasticSearch fields prefixed with “@”)
删除ElasticSearch中不必要的字段(Remove unnecessary fields in ElasticSearch)
在elasticsearch中组合字段(combine fields in elasticsearch)
Elasticsearch聚合7个字段(Elasticsearch aggregation by 7 fields)
过滤Elasticsearch可选字段(Filtering on Elasticsearch Optional Fields)
SQL Query在前缀和非前缀字段上连接两个表(SQL Query that joins two tables on a prefixed and non prefixed field)
ElasticSearch命中没有字段(ElasticSearch hits have no fields)
Elasticsearch - 获取嵌套字段(Elasticsearch - get nested fields)
相关文章
更多Spring MVC 3 深入总结
Spring MVC与表单提交的问题
第二章 Spring MVC入门 —— 跟开涛学SpringMVC
深入解析Spring MVC与Web Flow
spring boot 整合 ueditor 教程二:使用springmvc替换controller.jsp
请教关于spring mvc中使用json-lib-ext-spring返回json的问题
spring3MVC +spring security3 关于扩展UserDetailsService 无法注入service的疑问.
rails model的一点疑惑。。。。。
最新问答
更多python的访问器方法有哪些
使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
透明度错误IE11(Transparency bug IE11)
linux的基本操作命令。。。
响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
元素上的盒子阴影行为(box-shadow behaviour on elements)
它看起来像只在Windows上的Chrome的错误。 我在Google Canary (Chrome 63)中也进行了测试,问题依然存在,所以有可能它不会很快修复。 这个问题是由overflow: auto引起的overflow: auto ,在你的情况下,它可以很容易地通过删除或设置为可见(默认)来解决。 但是 ,将鼠标悬停在右侧(顶部和底部)时,会出现滚动条。 一个解决方案可以设置overflow: hidden的身体,所以预期的结果是所需的。 我想指出,这不是一个很好的解决方案,但我建议暂
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
这取决于您是否要以后与用户合作,或仅检查是否存在。 如果要使用用户对象(如果存在): $user = User::where('email', '=', Input::get('email'))->first(); if ($user === null) { // user doesn't exist } 如果你只想检查 if (User::where('email', '=', Input::get('email'))->count() > 0) { // user found
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
$scope.getData= function () { var reader = new FileReader(); reader.onload = $('input[type=file]')[0].files; var img = new Image(); img.src =(reader.onload[0].result); img.onload = function() { if(this.width > 640
Copyright ©2023
peixunduo.com All
Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!