即使我试图打开简单的JSF页面,它也会抛出异常,我甚至没有得到单个提示代码有什么问题。
我有像这样的xhtml
<table border="0" bordercolor="red" width="100%" cellspacing="0"
cellpadding="0">
<tr>
<td><h:messages errorClass="crudMessageError"
styleClass="crudmessagebackground" infoClass="crudmessageInfo"
layout="table" />
</td>
</tr>
<tr>
<td width="100%" align="left">
<a4j:form id="searchTrans">
<table width="99%" border="0" bordercolor="red" cellpadding="3"
cellspacing="0" class="bodyTable">
<tr>
<td colspan="4">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td width="15%"><h:outputText
value="#{label.counterPartOne}" class="globalHd" /></td>
<td width="120px"><h:inputText id="txtCounterPart1"
value="" >
</h:inputText></td>
<td width="15%"><h:outputText
value="#{label.counterPartTwo}" class="globalHd" /></td>
<td width="120px"><h:inputText id="txtCounterPart2"
value="" required="true"
styleClass="mandatoryTextField"
requiredMessage="#{validation.customerRequiredMessage}"
validator="#{customerController.validateForm}"
maxlength="15">
</h:inputText></td>
</tr>
<tr>
<td width="15%"><h:outputText
value="#{label.transactionsGroup}" class="globalHd" /></td>
<td width="120px"><h:selectOneMenu id="DDLTransGrp"
value="">
<f:selectItem id="1" itemLabel="Type1" itemValue="Type1" />
<f:selectItem id="2" itemLabel="Type2" itemValue="Type2" />
<f:selectItem id="3" itemLabel="Type3" itemValue="Type3" />
<f:selectItem id="4" itemLabel="Type4" itemValue="Type4" />
<f:selectItem id="5" itemLabel="Type5" itemValue="Type5" />
</h:selectOneMenu></td>
<td width="15%"><h:outputText
value="#{label.transactionType}" class="globalHd" /></td>
<td width="120px"><h:selectOneMenu id="DDLTransType"
value="">
<f:selectItem id="1" itemLabel="Type1" itemValue="Type1" />
<f:selectItem id="2" itemLabel="Type2" itemValue="Type2" />
<f:selectItem id="3" itemLabel="Type3" itemValue="Type3" />
<f:selectItem id="4" itemLabel="Type4" itemValue="Type4" />
<f:selectItem id="5" itemLabel="Type5" itemValue="Type5" />
</h:selectOneMenu></td>
</tr>
<tr>
<td width="15%">
<h:outputText
value="#{label.profitCenter}" class="globalHd" />
</td>
<td width="120px">
<h:inputText id="txtProfitCenter" value="" />
</td>
<td width="15%">
<h:outputText value="#{label.outstandingOnly}" class="globalHd" /></td>
<td width="120px">
<h:selectBooleanCheckbox value="" id="chkOutstanding"/>
</td>
</tr>
<tr>
<td width="15%">
<h:outputText value="#{label.completed}" class="globalHd" />
</td>
<td width="120px">
<h:selectBooleanCheckbox value="" id="chkComplete"/>
</td>
<td width="15%">
<h:outputText value="#{label.positionDesk}" class="globalHd" />
</td>
<td width="120px">
<h:selectBooleanCheckbox value="" id="chkPositionDesk"/>
</td>
</tr>
<tr>
<td width="15%">
<h:outputText value="#{label.currency}" class="globalHd" />
</td>
<td width="120px"><h:selectOneMenu id="DDLTransType"
value="">
<f:selectItem id="1" itemLabel="SAR" itemValue="SAR" />
<f:selectItem id="2" itemLabel="USD" itemValue="USD" />
</h:selectOneMenu></td>
<td width="15%">
<h:outputText value="#{label.tradingOfficer}" class="globalHd" />
</td>
<td width="120px">
<h:inputText value="" id="txtTradingOfficer"/>
</td>
</tr>
<tr>
<td width="15%"></td>
<td style="width: 60px">
<a4j:commandButton id="searchButton" value="#{button.search}" styleClass="mybutton" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</a4j:form></td>
</tr>
</table>
</ui:composition>
这是我在尝试加载xhtml页面时遇到的主要异常
javax.servlet.ServletException: 1
javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
com.bsf.web.core.SessionTimeOutFilter.doFilter(SessionTimeOutFilter.java:75)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
这是由同样的例外产生的根本原因。
根本原因
java.lang.IllegalArgumentException: 1
javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:549)
javax.faces.component.UIComponentBase.setId(UIComponentBase.java:351)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:151)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:73)
com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:54)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:54)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:175)
com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:73)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
com.bsf.web.core.SessionTimeOutFilter.doFilter(SessionTimeOutFilter.java:75)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
答案 0 :(得分:9)
根本原因是这一行:
<f:selectItem id="1" itemLabel="Type1" itemValue="Type1" />
id
不能以数字开头。
设置此
UIComponent
的组件标识符(如果有)。组件标识符必须遵守以下语法限制:
- 不得为零长度字符串。
- 第一个字符必须是字母或下划线('_')。
- 后续字符必须是字母,数字,下划线('_')或短划线(' - ')。
抛出:
IllegalArgumentException
- 如果id
在语法上无效