Java 如何使用属性文件使用struts2更改jquerytheme

Java 如何使用属性文件使用struts2更改jquerytheme,java,jquery,jquery-ui,struts2,properties-file,Java,Jquery,Jquery Ui,Struts2,Properties File,这在某种程度上与我的有关,在我的中,我可以通过以下方式显示从属性文件获取其URL的图像: <img height="40" src="<s:text name="login.logo"/>" class="pagelogo" alt="Logo" /> Login <sj:head locale="es" jqueryui="true" jquerytheme="<s:text name="gui.theme"/>" compressed="false

这在某种程度上与我的有关,在我的中,我可以通过以下方式显示从属性文件获取其URL的图像:

<img height="40" src="<s:text name="login.logo"/>" class="pagelogo" alt="Logo" /> Login
<sj:head locale="es" jqueryui="true" jquerytheme="<s:text name="gui.theme"/>" compressed="false" defaultIndicator="ajax_loading" />
其中我的
content.properties
看起来像这样:

login.logo=/oneFolderBefore/resources/media/login.png
login.title=Login
welcome.color=red
gui.theme=blitzer
java.lang.RuntimeException: org.apache.jasper.JasperException: /WEB-INF/decorators/PlantillaWeb.jsp (line: [37], column: [73]) equal symbol expected
    com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:39)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
    org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164)
    org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:191)
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:372)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276)
    com.seguritech.botones.plugin.interceptor.ValidarSesionInterceptor.intercept(ValidarSesionInterceptor.java:51)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.CookieProviderInterceptor.intercept(CookieProviderInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.CookieInterceptor.intercept(CookieInterceptor.java:258)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.CookieInterceptor.intercept(CookieInterceptor.java:258)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:575)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
这是一个可用主题和

但是,以这种方式调用时:

<img height="40" src="<s:text name="login.logo"/>" class="pagelogo" alt="Logo" /> Login
<sj:head locale="es" jqueryui="true" jquerytheme="<s:text name="gui.theme"/>" compressed="false" defaultIndicator="ajax_loading" />
其中,第37行为上述内容,第73列位于
gui.theme
中的
me
之间

因此,我认为在将内部双引号更改为单引号时:

<sj:head locale="es" jqueryui="true" jquerytheme="<s:text name='gui.theme'/>" compressed="false" defaultIndicator="ajax_loading" />

但当我检查我的HTML时,我得到:

<link id="jquery_theme_link" rel="stylesheet" href="/my-project/struts/themes/<s:text name='gui.theme'/>/jquery-ui.css?s2j=3.7.1" type="text/css">
<link id="jquery_theme_link" rel="stylesheet" href="/my-project/struts/themes/<s:text name=" gui.theme"="">

如果我把外面的换成这样:

<sj:head locale="es" jqueryui="true" jquerytheme='<s:text name="gui.theme"/>' compressed="false" defaultIndicator="ajax_loading" />
gui.current.theme=south-street

gui.theme.url.part1=//code.jquery.com/ui/1.10.4/themes/
gui.theme.url.part2=/jquery-ui.css
<link id="stylesheet" rel="stylesheet" href="<s:text name="gui.theme.url.part1" /><s:text name="gui.current.theme" /><s:text name="gui.theme.url.part2" />" />

我明白了:

<link id="jquery_theme_link" rel="stylesheet" href="/my-project/struts/themes/<s:text name='gui.theme'/>/jquery-ui.css?s2j=3.7.1" type="text/css">
<link id="jquery_theme_link" rel="stylesheet" href="/my-project/struts/themes/<s:text name=" gui.theme"="">

我结束了这一行:

<sj:head locale="es" jqueryui="true" jquerytheme="base" compressed="false" defaultIndicator="ajax_loading" />
上面这条线是这样划分的:

<sj:head locale="es" jqueryui="true" jquerytheme='<s:text name="gui.theme"/>' compressed="false" defaultIndicator="ajax_loading" />
gui.current.theme=south-street

gui.theme.url.part1=//code.jquery.com/ui/1.10.4/themes/
gui.theme.url.part2=/jquery-ui.css
<link id="stylesheet" rel="stylesheet" href="<s:text name="gui.theme.url.part1" /><s:text name="gui.current.theme" /><s:text name="gui.theme.url.part2" />" />


通过这些更改,我可以做我想做的事情,现在我的主题根据我在
gui.current.theme
属性中编写的任何主题(包括在页面中)更改其CSS样式。

Struts标记语法不允许您使用EL表达式。@RomanC是的,这也是我在上一个问题中发现的。。。这就是我在尝试使用
s:text name
try first时没有考虑的原因,但是当我做不到这一点时,我决定尝试使用EL表达式,只是为了试试运气。然而,我找遍了所有我能想到的方法,却找不到类似的东西。你知道怎么做我想做的吗?任何解决方法都可能有所帮助您可以通过多种方式加载属性,然后将其应用于操作。