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
2024-04-23 12:04

满意答案

这些设置不会影响任何事情。 它们是标准化的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)

您正在使用的文本查询前一段时间已被弃用(有效重命名),以支持匹配查询 。 匹配查询支持单个字段,但您可以使用multi_match查询 ,该查询支持非常相同的选项并允许在多个字段上进行搜索。 这是一个应该对你有帮助的例子: { "query" : { "multi_match" : { "fields" : ["title", "subtitle"], "query" : "trying out ela", ...

前缀 - 这意味着什么(prefixed - what does this means)

根据Mozilla页面: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB “由于规范仍在不断发展,IndexedDB的当前实现隐藏在浏览器前缀之下。浏览器供应商可能会有不同的标准IndexedDB API实现,直到规范得到巩固。但是一旦达到标准的共识,供应商就会在没有前缀的情况下实现它。实际上一些实现已经删除了前缀:Internet Explorer 10,Firefox 16,Chrom...

ElasticSearch字段前缀为“@”(ElasticSearch fields prefixed with “@”)

这些设置不会影响任何事情。 它们是标准化的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...

删除ElasticSearch中不必要的字段(Remove unnecessary fields in ElasticSearch)

您可以使用任何logstash过滤器删除字段 - 当过滤器成功时,它将删除该字段。 使用mutate对我来说很有意义: filter { mutate { remove_field => [ "file" ] } } 也就是说,这些领域中的大多数都非常有用,实际上不应该删除。 You can remove fields using really any logstash filter - when the filter succeeds, it will remo...

在elasticsearch中组合字段(combine fields in elasticsearch)

SQL和Elasticsearch之间的关键区别在于,默认情况下, 在索引时分析字符串字段,您可以控制使用分析程序分析字符串的方式。 默认分析器标准分析器将从输入生成标记并将它们存储在倒排索引中。 您可以使用Analyze API查看为给定输入生成的令牌: curl -XPOST "http://localhost:9200/_analyze?analyzer=standard" -d' { text : "3-Series" }' 产生输出 { "tokens": [ { ...

Elasticsearch聚合7个字段(Elasticsearch aggregation by 7 fields)

根据Elasticsearch文档: “术语聚合不支持从同一文档中的多个字段收集术语。原因是术语字段本身不收集字符串术语值,而是使用全局序数来生成所有唯一值的列表。全球序数导致重要的性能提升,这在多个领域是不可能的。 您可以使用两种方法在多个字段中执行术语聚合: 脚本使用脚本从多个字段中检索术语。 这会禁用全局序数优化,并且比从单个字段中收集术语要慢,但它使您可以灵活地在搜索时实现此选项。 copy_to字段如果您提前知道要从两个或多个字段中收集术语,请在映射中使用copy_to在索引时创建一个包...

过滤Elasticsearch可选字段(Filtering on Elasticsearch Optional Fields)

我不知道为什么你的工作没有用,但我过去使用bool过滤器取得了巨大的成功。 should选项基本上是一个or确保至少有一个是真的。 如果它仍然不起作用,试一试并评论我的答案。 另外仔细检查我正确复制了你的查询条款:) { "filtered" : { "query" : { "match_phrase_prefix": { "display_name": "SearchQuery" } ...

SQL Query在前缀和非前缀字段上连接两个表(SQL Query that joins two tables on a prefixed and non prefixed field)

Access SQL不支持CONCATENATE() 。 通常,您将使用&进行连接。 但是我不认为你需要为你的连接的ON条件连接任何东西。 只需使用Mid()忽略前2个字符...... ON Mid(a.ID, 3) = b.ID 这应该有效,但随着时间的推移,表格可能变得不可接受。 通过在每次导入后立即“清理” a.ID值,您应该获得更好的性能... UPDATE a SET ID = Mid(ID, 3) WHERE ID ALike '31%'; 那么你的SELECT查询的连接可以使用更...

ElasticSearch命中没有字段(ElasticSearch hits have no fields)

仅在尝试获取存储的字段时使用字段。 默认情况下,您应该使用源获取字段。 使用以下代码示例,我将尝试解释它。 PUT documents { "settings": { "number_of_replicas": 0, "number_of_shards": 1 }, "mappings": { "document": { "properties": { "title": { "type": "text", ...

Elasticsearch - 获取嵌套字段(Elasticsearch - get nested fields)

如果你没有一个特定的查询应该匹配嵌套的字段,你可以这样做: GET /index/_search { "size": 10, "_source": ["nested_fields.id", "nested_fields.name"] } 如果您还有一个nested查询并且想要返回匹配的嵌套文档,则可以这样做(使用inner_hits ): { "query": { "nested": { "path": "nested_fields", "query"...

相关文章

更多

Spring MVC 3 深入总结

一、前言: 大家好,Spring3 MVC是非常优秀的MVC框架,由其是在3.0版本发布后,现在有越来 ...

Spring MVC与表单提交的问题

1.model: public class UserType implements Serializ ...

第二章 Spring MVC入门 —— 跟开涛学SpringMVC

Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级We ...

深入解析Spring MVC与Web Flow

深入解析Spring MVC与Web Flow的内容摘要:英文版:Expert Spring MVC ...

spring boot 整合 ueditor 教程二:使用springmvc替换controller.jsp

下载ueditor1_4_3_3里有一个jsp的文件夹,那是官方提供的java 工具类,有一个lib目 ...

请教关于spring mvc中使用json-lib-ext-spring返回json的问题

我做了一个这样的框架: spring+hibernate+spring mvc 想让spring ...

spring3MVC +spring security3 关于扩展UserDetailsService 无法注入service的疑问.

问题描述: 我想用的spring3MVC+spring security3 实现登录权限的扩展.即扩 ...

rails model的一点疑惑。。。。。

在rails中生成的model里面定义的属性都直接对应数据库字段,如何定义不需要对应数据库的属性呢? ...

最新问答

更多

python的访问器方法有哪些

使用方法: class A(object): def foo(self,x): #类实例方法 print "executing foo(%s,%s)"%(self,x) @classmethod def class_foo(cls,x): #类方法 print "executing class_foo(%s,%s)"%(cls,x) @staticmethod def static_foo(x): #静态方法 print "executing static_foo(%s)"%x调用方法: a =

使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)

我认为你必须将两个TableGetway传递给UserTable构造。 你必须改变Module.php看看: public function getServiceConfig() { return array( 'factories' => array( 'User\Model\UserTable' => function($sm) { $userTableGateway = $sm->get('UserTable

透明度错误IE11(Transparency bug IE11)

这是一个渲染错误,由使用透明度触发,使用bootstrap用于在聚焦控件周围放置蓝色光环的box-shadow属性。 可以通过添加以下类覆盖来解决它。 .form-control:hover { -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); box-shadow: 0px 0px 4px 0px rgba(0,0,255,1)

linux的基本操作命令。。。

ls 显示目录 mkdir 建立目录 cd 进入目录

响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)

将z-index设置为.main-nav这将解决您的重叠问题 .main-nav { position:relative; z-index:9; } set z-index to .main-nav This will fix your overlaping issue .main-nav { position:relative; z-index:9; }

在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)

这是因为模式规范"a"打开一个文件以便追加,文件指针在末尾。 如果您尝试从此处读取,则由于文件指针位于EOF,因此没有数据。 您应该打开"r+"进行阅读和写作。 如果在写入之前读取整个文件,则在写入更多数据时,文件指针将正确定位以追加。 如果这还不够,请探索ftell()和fseek()函数。 That is because the mode spec "a" opens a file for appending, with the file pointer at the end. If you

NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)

支持空中接口的数据速率是一回事。 在消除协议开销,等待eeprom写入以及所有需要时间的其他内容之后,您看到的数据速率是完全不同的故事。 长话短说,从标签读取或进行对等传输时的实际数据速率峰值约为2.5千字节/秒。 取决于具体的标签或对等技术,它可能比这慢很多。 The supported data-rates of the air-interface are one thing. The data-rate that you see after removing protocol overhe

元素上的盒子阴影行为(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