0 Replies Latest reply on Sep 22, 2002 5:39 PM by Manoj G. Kithany

    Simple Bean not working

    Manoj G. Kithany Newbie

      Hi JBosses,

      I tried a simple JSP/Servlet applications and it worked. I am using Apache 1.3.26 + (Jboss 3.0.3, Tomcat 4.0.4 bundle)

      Now, I am trying for simple Bean Application with JSP/Servlets and Html pages. My directory structure is :

      /kithany (root)
      /kithany/register.html
      /kithany/success.jsp
      /kithany/retry.jsp
      /kithany/process.jsp (bean)
      /kithany/WEB-INF/web.xml
      /kithany/WEB-INF/classes/FormBean.java
      /kithany/WEB-INF/classes/FormBean.class
      /kithany/META-INF/application.xml

      Then, I create the kithany.war file as shown below:

      #cd /kithany
      #jar -cvfM kithany.war .

      I then put the "kithany.war" file in /jboss/server/default/deploy directory and In your browser type:

      http://IP_ADDR_ESS:8080/kithany/register.html

      which works fine. In my "register.html" file my action is <form action="/kithany/process.jsp" method=post>
      When I click the SUBMIT button in "register.html" form (which then calls bean and servelte), I get following Error - wonder why.

      ------------------------------------------------------------------------------------
      Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error - that prevented it from fulfilling this request

      org.apache.jasper.JasperException: Unable to compile class for JSP
      An error occurred at line: 10 in the jsp file: /process.jsp

      Generated servlet error:
      /jboss-3.0.0_tomcat-4.0.3/catalina/work/localhost/kithany/process$jsp.java:72: Class org.apache.jsp.FormBean not found.
      FormBean formHandler = null;
      ^

      An error occurred at line: 10 in the jsp file: /process.jsp

      Generated servlet error:
      /jboss-3.0.0_tomcat-4.0.3/catalina/work/localhost/kithany/process$jsp.java:75: Class org.apache.jsp.FormBean not found.
      formHandler= (FormBean)
      ^
      An error occurred at line: 10 in the jsp file: /process.jsp

      Generated servlet error:
      /jboss-3.0.0_tomcat-4.0.3/catalina/work/localhost/kithany/process$jsp.java:80: Class org.apache.jsp.FormBean not found.
      formHandler = (FormBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "FormBean");

      ------------------------------------------------------------------------------------

      My process.jsp file is:
      ------------------------------------------------------------------------------------
      <%@ page import="java.util.*" %>

      <%!
      ResourceBundle bundle =null;
      public void jspInit() {
      bundle = ResourceBundle.getBundle("forms");
      }
      %>

      <jsp:useBean id="formHandler" class="FormBean" scope="request"> ****** THIS IS MY LINE 10
      <jsp:setProperty name="formHandler" property="*"/>
      </jsp:useBean>

      <%
      if (formHandler.validate()) {
      %>
      <jsp:forward page="<%=bundle.getString(\"/kithany/process.success\")%>"/>
      <%
      } else {
      %>
      <jsp:forward page="<%=bundle.getString(\"/kithany/process.retry\")%>"/>
      <%
      }
      %>
      ------------------------------------------------------------------------------------

      My web.xml file is as shown below:
      -------------------------------------------------------------------------------
      <web-app>

      <servlet-name>FormBean</servlet-name>
      <servlet-class>FormBean</servlet-class>


      <servlet-name>HelloWorldExample</servlet-name>
      <servlet-class>HelloWorldExample</servlet-class>

      <servlet-mapping>
      <servlet-name>HelloWorldExample</servlet-name>
      <url-pattern>/HelloWorldExample/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>FormBean</servlet-name>
      <url-pattern>/FormBean/*</url-pattern>
      </servlet-mapping>
      <web-app>
      -------------------------------------------------------------------------------

      I would really appreciate if any of you JBosses could put some light onto this error.

      THANKS!

      Manoj G. Kithany