How can we use deploytool when we use both jsp and servlets ?

Discussions

General J2EE: How can we use deploytool when we use both jsp and servlets ?

  1. I have created an application that uses both JSP and Servlets and Java Beans .. (MVC pattern)... When I create a web component in deploytool what do I select ? Do I select all the jsp and servlets and java beans (NOT EJB) ?

    If I do that then in the next step I have to select type of component which lets me select either a JSP or servlet but not both..

    Should I repeat and create 2 web components seperate for Servlets and JSP? and seperate for java beans as well ?

    The application starts with a jsp page.

    Does anyone know ?
    Priyanka
  2. When I try to access the first asp page loads but the servlet that it calls does not.. It says "The request source (/servlet.PhoneBook.SearchPhoneBookServlet) is unavailable"

    I created another application with a servlet which works but cant get it to work with a jsp ?
  3. Hi Priyanka,

    which application server are you trying to use ??

    Regards.
  4. Priyanka is using J2EE RI, right?

    Add all your files to the WAR then add web components for each JSP and servlet.

    Servlets live under CONTEXT/servlet so your action code should be servlet/servlet.blahblah.XServlet. This is different for JSPs that you use (via forward(request,response)) from within servlets: the response is from the servlet (though generated by the JSP) so the browser's context is already CONTEXT/servlet and actions should not start with servlet/ in this case.
  5. I am using J2ee Server..

    When I use deploytool and Go to File> New > Web Component > Once I select the files (java beans) it gives you two options in the next screen which are just Servlet or JSP or No Component...So What should be selected here?

    For EJB there is a option saying File > New > EJB But Nothing for a Java Bean ?

    How do I run my JSP files that use Java beans?

    I also have servlets that I am using as controllers..

    Is there a way I can deploy using deploytool?
  6. "Add all your files to the WAR then add web components for each JSP and servlet." :-)

    JavaBeans do not have to be described.

    Let's put this down in a to-do list:
    1. Create the application (EAR)
    2. Add a web component (creating the WAR in the process)
     2.1. Add everything (all your html pages, JSPs, servlets, JavaBeans, properties files, utility classes and whatever else needs to be in the web application) to the WAR.
     2.2. Describe the first web component (JSP or servlet)
    3. For each remaining JSP or servlet:
     3.1. Add a web component (to the WAR)
      3.1.1. Describe the JSP or servlet
  7. what should i select for a java bean?
  8. Posted by Priyanka S 2002-11-18 12:19:57.0.
    "what should i select for a java bean?"

    Nothing. You put them into the WAR but do nothing else. You describe just the JSPs and the servlets.
  9. Let's put this down in a to-do list:
    1. Create the application (EAR)
    2. Add a web component (creating the WAR in the process)
     2.1. Add everything (all your html pages, JSPs, servlets, JavaBeans, properties files, utility classes and whatever else needs to be in the web application) to the WAR.
     2.2. Describe the first web component (JSP or servlet)
    3. For each remaining JSP or servlet:
     3.1. Add a web component (to the WAR)
      3.1.1. Describe the JSP or servlet

    After Step 2.1 where I add all the components I can select only JSP or Servlet and if I go back to describe the second component.. example if I selected a jsp first and go back and check servlet then the jsp selection is gone again...
    Also if I have 2 jsp I cannot selected both I can select ..
  10. Without the bean added to the Jsp the code works fine and displays the JSP Page ..

    When I add the Bean

    This is the error

    org.apache.jasper.JasperException: Unable to compile class for JSP

    An error occurred at line: 4 in the jsp file: /AddShow.jsp

    Generated servlet error:
    c:\j2sdkee1.3.1\repository\ucl31-wcsu\web\show\AddShow$jsp.java:65: Class org.apache.jsp.PRKV_AddBean not found.
                    PRKV_AddBean addBean = null;
                    ^


    An error occurred at line: 4 in the jsp file: /AddShow.jsp

    Generated servlet error:
    c:\j2sdkee1.3.1\repository\ucl31-wcsu\web\show\AddShow$jsp.java:68: Class org.apache.jsp.PRKV_AddBean not found.
                        addBean= (PRKV_AddBean)
                                  ^


    An error occurred at line: 4 in the jsp file: /AddShow.jsp

    Generated servlet error:
    c:\j2sdkee1.3.1\repository\ucl31-wcsu\web\show\AddShow$jsp.java:73: Class org.apache.jsp.PRKV_AddBean not found.
                                addBean = (PRKV_AddBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "PRKV_AddBean");
                                           ^
    3 errors
  11. I got it working !!!! THANKS !!!