在jsp或javascript中访问spring属性

在jsp或javascript中访问spring属性,spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,我在spring属性中配置了pageSize变量。我需要在几乎所有JSP中访问这个pageSize属性。什么是最好的方式来获得这个春天的财产 src\main\resources\web.properties包含default.page.items.size=10 <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> <property name

我在spring属性中配置了pageSize变量。我需要在几乎所有JSP中访问这个pageSize属性。什么是最好的方式来获得这个春天的财产

src\main\resources\web.properties包含default.page.items.size=10

  <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
    <property name="locations">
      <list>
        <value>classpath:web.properties</value>
        <value>classpath:core.properties</value>
      </list>
    </property>
  </bean>

类路径:web.properties
类路径:core.properties

我知道如何访问控制器中的属性,但由于此属性已被访问,我的多页因此我想以某种方式直接访问它javascript或jsp

我在dispatcher上下文中的一个旧项目(不确定是否仍然有效)中使用了此属性声明一个bean,如:

<bean id="myProps" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
               <list>
                     <value>classpath:web.properties</value>
                     <value>classpath:core.properties</value>
                </list>
         </property>
</bean>

类路径:web.properties
类路径:core.properties
然后,如果使用标准JSTL视图解析器:

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
          <property name="order" value="2"></property>
          <property name="viewClass"
                  value="org.springframework.web.servlet.view.JstlView" />
          <property name="prefix" value="/WEB-INF/jsp/" />
          <property name="suffix" value=".jsp" />
          <property name="exposedContextBeanNames">
               <list>
                     <value>myProps</value>
               </list>
          </property>
</bean>

我的道具

您应该能够使用
${myProps.XXX}

访问JSP内部的属性,您所说的spring属性是什么意思?spring mvc资源属性查看spring mvc Internalization Sotirios:更新了帖子上面的解决方案对我不起作用,因为我使用的是UrlBasedViewResolver