hibernate - javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20 -


i error when deploy jsf page. use hibernate. want create simple jsp form 1 java class.

javax.servlet.servletexception: pwc1232: exceeded maximum depth nested request dispatches: 20

my faces-config.xml:

<?xml version="1.0" encoding="utf-8"?> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"  xmlns:xi="http://www.w3.org/2001/xinclude"  xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">  <managed-bean>   <managed-bean-name>modeltime</managed-bean-name>   <managed-bean-class>org.projet.modeltime</managed-bean-class>   <managed-bean-scope>request</managed-bean-scope>  </managed-bean>   <navigation-rule> <display-name> home</display-name>   <from-view-id> /index.jsp</from-view-id>    <navigation-case> <from-outcome>newtimesheet</from-outcome>    <to-view-id> /newtimesheet.jsp</to-view-id>    </navigation-case>    </navigation-rule> </faces-config> 

my web.xml:

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5">   <display-name>time</display-name>   <welcome-file-list>     <welcome-file>index.html</welcome-file>     <welcome-file>index.htm</welcome-file>     <welcome-file>index.jsp</welcome-file>     <welcome-file>default.html</welcome-file>     <welcome-file>default.htm</welcome-file>     <welcome-file>default.jsp</welcome-file>   </welcome-file-list>   <servlet>     <servlet-name>faces servlet</servlet-name>     <servlet-class>javax.faces.webapp.facesservlet</servlet-class>     <load-on-startup>1</load-on-startup>   </servlet>   <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.jsp</url-pattern>   </servlet-mapping>   <context-param>     <description>state saving method: 'client' or 'server' (=default). see jsf specification 2.5.2</description>     <param-name>javax.faces.state_saving_method</param-name>     <param-value>client</param-value>   </context-param>   <context-param>     <param-name>javax.servlet.jsp.jstl.fmt.localizationcontext</param-name>     <param-value>resources.application</param-value>   </context-param>   <listener>     <listener-class>com.sun.faces.config.configurelistener</listener-class>   </listener>   <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.jsf</url-pattern>   </servlet-mapping>   <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.faces</url-pattern>   </servlet-mapping> </web-app> 

my newtimesheet.jsp:

<%@ page session="true" isthreadsafe="true" import="org.projet.*,java.net.*, java.io.*, java.util.*,net.sf.hibernate.*,net.sf.hibernate.cfg.*,net.sf.hibernate.expression.*" %>   <html>      <head>         <meta http-equiv="content-language" content="en-us">         <meta http-equiv="content-type" content="text/html; charset=windows-1252">         <title>newtimesheet</title>     </head>           <body topmargin="0" leftmargin="0" vlink="#0000ff" alink="#0000ff">          <div align="left">           <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="84%" height="228" align="left">             <tr>               <td width="13%" height="35" align="left" valign="top">&nbsp;</td>               <td width="87%" height="35" align="left" valign="bottom">               <font face="arial"><b>create new &quot;timesheet&quot;</b></font></td>             </tr>             <tr>               <td width="14%" height="192" align="left" valign="top">&nbsp;</td>               <td width="86%" height="192" align="left" valign="top">               <form method="post" action="newtimesheet.jsp">               <input type="hidden" name="cid" value="1">                 <font face="courier new"><font size="2"><br>                 <br>                 category:&nbsp;&nbsp;&nbsp;&nbsp; </font>                 <input type="text" name="formcategorymsg" size="38"><font size="2"><br>                 description:&nbsp; </font><input type="text" name="formcategorydescription" size="38"><br>         &nbsp;</font></p>                 <p align="left"><font face="courier new">                 <input type="submit" value="submit" name="b1"><input type="reset" value="reset" name="b2"></font></p>               </form>               <p>&nbsp;</td>             </tr>           </table>         </div>      </body>  </html>  <%! 

how caused , how can solve it?

this entry

  <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.jsp</url-pattern>   </servlet-mapping> 

is causing facesservlet run in infinite loop because jsf delegate jsp servlet when resolving views, you've mapped facesservlet listen on same url pattern servletcontainer's builtin jsp servlet!

replace more jsf-specific url pattern such *.jsf

  <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.jsf</url-pattern>   </servlet-mapping> 

and change jsf request urls end *.jsf instead.


unrelated concrete problem, form not utilizing jsf tags , managed bean bindings. wonder how jsf configuration relevant you. might want spend time in learning jsf first.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -