Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2008, 05:26 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to reset the form?

Hi,
I am facing some problem while trying to reset the form.
I am using convertors and validators on the same form elements so I have enabled the "immediate" property of reset button to "true" to avoid the validation process, and in backing bean I am setting the field values but the new values are not getting reflefted in front view. As I can see there is no request made to get the new values from backing bean.

Here are the code snippets:

1. Front view - facelet



<ice:outputLabel value="${msgs['common_name']}"></ice:outputLabel>
                              <ice:panelGrid columns="2">
                             <ice:inputText style="width:500px"
                                 value="${roleManagementController.id}" id="name"
                                 partialSubmit="true" required="true"
                                 requiredMessage="${msgs['validationerror_name'] }"
                                 disabled="${!roleManagementController.addMode}" ></ice:inputText>
                                 <ice:message for="name" style="color" style="color:ff0000" >



b. Reset button :


  <ice:commandButton value="${msgs['reset']}"
                         actionListener="${actionController.reset}" style="margin-right:50px;margin-left:50px" immediate="true"/>




2. Backing bean -

a.

/**
      * @param role
      */
     public void reset(ActionEvent actionEvent) {
         id = null; renderManager.getOnDemandRenderer(sessionId).reque stRender();
     }



b.

public void setRenderManager(RenderManager renderManager) {
             this.renderManager = renderManager;
             renderManager.getOnDemandRenderer(sessionId).add(t his);
         }

      public PersistentFacesState getState() {
          System.out.println("RoleManagementController.getSt ate()");
             return persistentFacesState;
        }





public void renderingException(RenderingException arg0) {
         System.out.println("RoleManagementController.rende ringException()");
         // TODO Auto-generated method stub

     }



3. Web.xml



<servlet>
         <servlet-name>Blocking Servlet</servlet-name>
         <servlet-class>
             com.icesoft.faces.webapp.xmlhttp.BlockingServlet
         </servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>

     <servlet>
         <servlet-name>Tomcat Push Servlet</servlet-name>
         <servlet-class>
             com.icesoft.faces.webapp.http.servlet.TomcatPushSe rvlet
         </servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>



     <servlet-mapping>
         <servlet-name>Blocking Servlet</servlet-name>
         <url-pattern>*.iface</url-pattern>
     </servlet-mapping>

 <servlet-mapping>
         <servlet-name>Tomcat Push Servlet</servlet-name>
         <url-pattern>*.iface</url-pattern>
     </servlet-mapping>

  <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>

     <servlet>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentF acesServlet</servlet-class>
         <load-on-startup> 1 </load-on-startup>
     </servlet>





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


     <servlet-mapping>
          <servlet-name>uploadServlet</servlet-name>
          <url-pattern>/uploadHtml</url-pattern>
     </servlet-mapping>

     <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>*.iface</url-pattern>
     </servlet-mapping>

     <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>/xmlhttp/*</url-pattern>
     </servlet-mapping>





4. Server.xml file of Tomcat 6.0



 <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtoc ol"
                connectionTimeout="20000"
                redirectPort="8443" />



I tried to use Ajax push to forcefully update the front view values but I am getting this error:



Error : ep 26, 2008 5:24:46 PM org.apache.catalina.core.StandardWrapperValve invoke
 SEVERE: Servlet.service() for servlet jsp threw exception
 javax.servlet.ServletException: service() not supported by TomcatPushServlet. Configure the connector, replacing protocol="HTTP/1.1" with protocol="org.apache.coyote.http11.Http11NioProtoc ol"
     at com.icesoft.faces.webapp.http.servlet.TomcatPushSe rvlet.service(TomcatPushServlet.java:265)
     at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
     at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:630)
     at org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:436)
     at org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:374)
     at org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:302)
     at org.apache.jasper.runtime.PageContextImpl.doForwar d(PageContextImpl.java:696)
     at org.apache.jasper.runtime.PageContextImpl.forward( PageContextImpl.java:667)
     at org.apache.jsp.index_jsp._jspService(index_jsp.jav a:57)
     at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
     at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:374)
     at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:342)
     at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:267)
     at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
     at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
     at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
     at org.apache.coyote.http11.Http11NioProcessor.proces s(Http11NioProcessor.java:880)
     at org.apache.coyote.http11.Http11NioProtocol$Http11C onnectionHandler.process(Http11NioProtocol.java:71 9)
     at org.apache.tomcat.util.net.NioEndpoint$SocketProce ssor.run(NioEndpoint.java:2081)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
     at java.lang.Thread.run(Unknown Source)
 Sep 26, 2008 5:54:20 PM org.apache.coyote.http11.Http11NioProtocol pause
 INFO: Pausing Coyote HTTP/1.1 on http-8080
 Sep 26, 2008 5:54:21 PM org.apache.catalina.core.StandardService stop
 INFO: Stopping service Catalina

do you have any idea how to configure the web.xml and the server.xml in tomcat6.o.

I know one way to rest the form and that is, to have binding for all the form fileds and call the submittevValue of UIComponent in reset method on backing bean, but my form contains a lot of fields so I want to avoid doing form reset in that way.
It will be helpful if you guys can suggest me any other way to reset the form.
Thanks in advance.

Regards,
Vinay.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Notice: Undefined variable: comments/ Form reset dungey Pro PHP 10 December 1st, 2006 04:00 AM
Controlling reset method of form bean chamalsl Struts 2 August 8th, 2006 12:06 AM
BackgroundImage reset ryan.thomson VB.NET 2002/2003 Basics 0 October 25th, 2005 08:39 AM
how 2 reset a form kanoorani Javascript How-To 6 October 10th, 2005 05:45 AM
C# reset of checkbox after form submission booksnore2 General .NET 5 July 29th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.