当我尝试读取JSF页面中的属性文件时,我从服务器收到HTTP 500错误。从类文件中读取Bundle工作正常。
以下是我的Sample webapp的结构,它是Tomcat中的osgi包。清单文件中的类路径是web / WEB-INF / classes。因此资源包已经存在于类路径
中Sample
META-INF ---> MANIFEST.MF
web
App
home.jsp
login.jsp
index.html
WEB-INF
web.xml
faces-config.xml
classes-->myresource.properties
lib------>packaged jar
以下是我的home.jsp文件的内容,该文件存在于Sample / web / App目录中。
<f:loadBundle var="bundle" basename="com.obj.colours" />
<f:loadBundle var="addonpages" basename="CustomAddonPages" />
.
.
<h:outputText value='#{brandingBundle["label.ManagementConsole"]}' />
<!-- <a href="../CustomReport.faces">Custom Reporting </a> -->
<!-- below part gives error and i have to use the above hard
coded way using anchor tag-->
<h:commandLink action="#{addonpages.Redirectpage}">
<h:outputText value="Custom Reporting"/>
</h:commandLink>
属性文件包含一行
Redirectpage=../CustomReport.faces
服务器的错误如下
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.RuntimeException: javax.servlet.ServletException: #{addonpages.Redirectpage}: javax.faces.el.MethodNotFoundException: Redirectpage
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.serviceHelper(BundlePathAwareServiceHandler.java:254)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.service(BundlePathAwareServiceHandler.java:197)
com.businessobjects.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:220)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.businessobjects.pinger.TimeoutManagerFilter.doFilter(TimeoutManagerFilter.java:159)
root cause
javax.servlet.ServletException: #{addonpages.Redirectpage}: javax.faces.el.MethodNotFoundException: Redirectpage
javax.faces.webapp.FacesServlet.service(FacesServlet.java:225)
com.businessobjects.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:110)
com.businessobjects.http.servlet.internal.ServletLastFilterChainElement.service(ServletLastFilterChainElement.java:30)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:46)
com.businessobjects.webutil.boetrustguard.BOETrustValidateFilter.doFilter(BOETrustValidateFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.internal.filters.BrowserRenderingModeFilter.doFilter(BrowserRenderingModeFilter.java:20)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.boetrustguard.BOETrustPrepareFilter.doFilter(BOETrustPrepareFilter.java:32)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.shared.tracelog.TraceLogScopeFilter.doFilter(TraceLogScopeFilter.java:38)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.sdk.actionfilter.WorkflowFilter.doFilter(WorkflowFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.appcontext.RequestInitFilter.doFilter(RequestInitFilter.java:26)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.serviceHelper(BundlePathAwareServiceHandler.java:235)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.service(BundlePathAwareServiceHandler.java:197)
com.businessobjects.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:220)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.businessobjects.pinger.TimeoutManagerFilter.doFilter(TimeoutManagerFilter.java:159)
root cause
javax.faces.FacesException: #{addonpages.Redirectpage}: javax.faces.el.MethodNotFoundException: Redirectpage
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:94)
javax.faces.component.UICommand.broadcast(UICommand.java:332)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
com.businessobjects.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:110)
com.businessobjects.http.servlet.internal.ServletLastFilterChainElement.service(ServletLastFilterChainElement.java:30)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:46)
com.businessobjects.webutil.boetrustguard.BOETrustValidateFilter.doFilter(BOETrustValidateFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.internal.filters.BrowserRenderingModeFilter.doFilter(BrowserRenderingModeFilter.java:20)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.boetrustguard.BOETrustPrepareFilter.doFilter(BOETrustPrepareFilter.java:32)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.shared.tracelog.TraceLogScopeFilter.doFilter(TraceLogScopeFilter.java:38)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.sdk.actionfilter.WorkflowFilter.doFilter(WorkflowFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.appcontext.RequestInitFilter.doFilter(RequestInitFilter.java:26)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.serviceHelper(BundlePathAwareServiceHandler.java:235)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.service(BundlePathAwareServiceHandler.java:197)
com.businessobjects.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:220)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.businessobjects.pinger.TimeoutManagerFilter.doFilter(TimeoutManagerFilter.java:159)
root cause
javax.faces.el.MethodNotFoundException: Redirectpage
com.sun.faces.el.MethodBindingImpl.method(MethodBindingImpl.java:219)
com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:144)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
javax.faces.component.UICommand.broadcast(UICommand.java:332)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
com.businessobjects.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:110)
com.businessobjects.http.servlet.internal.ServletLastFilterChainElement.service(ServletLastFilterChainElement.java:30)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:46)
com.businessobjects.webutil.boetrustguard.BOETrustValidateFilter.doFilter(BOETrustValidateFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.internal.filters.BrowserRenderingModeFilter.doFilter(BrowserRenderingModeFilter.java:20)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.webutil.boetrustguard.BOETrustPrepareFilter.doFilter(BOETrustPrepareFilter.java:32)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.shared.tracelog.TraceLogScopeFilter.doFilter(TraceLogScopeFilter.java:38)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.sdk.actionfilter.WorkflowFilter.doFilter(WorkflowFilter.java:45)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.swd.appcontext.RequestInitFilter.doFilter(RequestInitFilter.java:26)
com.businessobjects.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:72)
com.businessobjects.http.servlet.internal.filter.FilterChainImpl.doFilter(FilterChainImpl.java:43)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.serviceHelper(BundlePathAwareServiceHandler.java:235)
com.businessobjects.http.servlet.internal.BundlePathAwareServiceHandler.service(BundlePathAwareServiceHandler.java:197)
com.businessobjects.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:220)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.businessobjects.pinger.TimeoutManagerFilter.doFilter(TimeoutManagerFilter.java:159)
答案 0 :(得分:0)
您得到一个MethodNotFoundException,因此找到了该类但该方法不存在。也许这种方法必须公开?
答案 1 :(得分:0)
我真的很抱歉在第一时间犯了一个严重的错误然后回答了我自己的问题。如果我向您展示了整个页面来源,可能是您的专家可能已经猜对了。
It is not possible to use h:commandLink when NOT present inside the form element and i should have used h:outputLink
然而,当我第一次修改页面并使用commandLink时,抛出的错误并不那么清楚,而且Balazs回答说我必须在commandLink的action属性中使用方法表达式。所以我继续创建自己的ResourceBundle类,然后在这个资源包中读取我的.properties,但我仍面临同样的问题。
接下来我尝试的不是修改供应商提供的webapp,而是在eclipse中创建了一个示例应用程序并在那里进行了测试。而这一次,Eclipse足够慷慨,可以显示带有commandLink空间的页面 -
commandLink can only be used when present inside form element
所以现在我正在使用outputLink并加载.properties文件包,它工作得很好。