2 Replies Latest reply on Mar 18, 2006 6:14 AM by Andrew Wallace

    Calling Servlet from JSP

    Andrew Wallace Newbie

      Hi all,

      I would greatly appreciate a response. I am reasonably new to JBoss, and I am having difficulty calling a servlet from my JSP files. I have searched google for a couple of hours, and not found anything specific to this problem and JBoss, so here goes:


      ***Servlet***

      package com.enterprise.servlet;

      import ........etc

      /**
      * Servlet Class
      *
      * @web.servlet name="SaveRequirementDetail"
      * display-name="SaveRequirementDetail"
      * description="Description for SaveRequirementDetail"
      * @web.servlet-mapping url-pattern="/SaveRequirementDetail"
      * @web.servlet-init-param name="A parameter"
      * value="A value"
      *@web.ejb-ref
      * name="ejb/Project"
      * type="Session"
      * home="enterprise.interfaces.ProjectHome"
      * remote="enterprise.interfaces.Project"
      * description="Reference to the Project EJB"
      *
      * @jboss.ejb-ref-jndi
      * ref-name="ejb/Project"
      * jndi-name="ejb/Project"
      */
      public class SaveRequirementDetail extends HttpServlet {
      ....etc

      ***web.xml***


      <servlet-name>SaveRequirementDetail</servlet-name>
      <display-name>SaveRequirementDetail</display-name>
      <![CDATA[Description for SaveRequirementDetail]]>
      <servlet-class>com.enterprise.servlet.SaveRequirementDetail</servlet-class>

      <init-param>
      <param-name>A parameter</param-name>
      <param-value>A value</param-value>
      </init-param>



      <servlet-mapping>
      <servlet-name>SaveRequirementDetail</servlet-name>
      <url-pattern>/SaveRequirementDetail</url-pattern>
      </servlet-mapping>

      ***application.xml***


      <display-name></display-name>

      ReinEjb.jar



      <web-uri>ReinWeb.war</web-uri>
      <context-root>/rein</context-root>





      Once deplyed, I can access the servlet by going to the url defined in servlet-mapping i.e.:

      localhost:8080/rein/SaveRequirementData

      However, when I try and access it from the JSP page with the following line:



      it returns the message that it is not available.

      So what do I have to put in here to get at it?

      The servlet itself is deployed into WEB-INF/classes/com/enterprise/servlet
      The JSP is deployed in the root (outside WEB-INF).

      Hope you can help

      Cheers

      Andy