Cannot invoke servlet from JSP

I am trying to invoke a servlet from my JSP file. At present I am getting the error:
500 Internal Server Error
java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found
     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindPageContext.forward
I understand that my JSP cannot find my servlet but I cannot identify what the correct path or amendment is.
My JSP file is located in:
default-web-app/examples/jsp/com.xml2spss.jsp
In the JSP my forward parameter is :
<jsp:forward page="/servlet/CreateSPSS" />
and my servlet (.java & .class) is located in
default-web-app/WEB-INF/classes/com/pmstation/spss/site/servlet.CreateSPSS.java
I have added the following line to Web.XML:
<servlet-mapping>
<servlet-name>CreateSPSS</servlet-name>
<url-pattern>/servlet/CreateSPSS</url-pattern>
</servlet-mapping>
Where am I going wrong??
Thankyou for any help at all on this one.

Shaun,
Nice to know that you find a way that works. However, what Zsolt suggests should work; otherwise, it is a bug. That is, put the servlet definition and servlet mapping in your web.xml and then you should be able to access http://host:port/myWebContext/servlet/CreateSPSS?myParmName=myParm without seeing a response like "No resource found". Please make sure that your servlet definition come before the corresponding servlet mapping.

Similar Messages

  • Error in invoking servlet from JSP

    Hi - again!
    after being thoroughly reprimanded for posting on the wrong board, and hence seeing the error in my ways, all help greatly appreciated....
    I have read elsewhere that it is possible to call a servlet (which produces HTML) from within a JSP, thus keeping a nice clean MVC paradigm and making it easier for non-java people to design the front-end.
    I am having difficulty getting it to work and any help is much appreciated:
    My servlet (Mole):
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                out.write("###some html stored in DB#####");
            } finally {
                out.close();
        }my JSP:
    <jsp:include page="Mole" flush="false"></jsp:include>the error I get
    Internal error flushing the buffer in release()
    StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
    java.io.IOException: Stream closed
            at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:257)
            at org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:206)
            at org.apache.jsp.CMS.services_jsp._jspService(services_jsp.java from :176)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
            at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
            at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)Any pointer as to what I am donig wrong?
    many thanks

    in your web.xml
    <servlet>
    <servlet-name>Mole</servlet-name>
    <servlet-class>srvlt.Mole</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Mole</servlet-name>
    <url-pattern>/Mole</url-pattern>
    </servlet-mapping>
    package srvlt;
    // Import servlet packages
    import javax.servlet.*;
    import javax.servlet.http.*;
    // Import other Java packages
    import java.io.*;
    public class Mole extends HttpServlet {
            public void init() throws ServletException {}
            public void doGet(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                response.setContentType("text/html;charset=UTF-8");
                PrintWriter out = response.getWriter();
                try {
                    out.write("###some html stored in DB#####");
                } finally {
                    out.close();
    }in your jsp
    <jsp:include page="/Mole" flush="false"></jsp:include>

  • How to invoke bpel from jsp

    Hi,
    I created a bpel application helloword.bpel which has one assign activity it takes input as a name i want to invoke this from jsp i write a code in jsp as follows:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="com.oracle.bpel.client.Locator" %>
    <%@ page import="com.oracle.bpel.client.NormalizedMessage" %>
    <%@ page import="com.oracle.bpel.client.dispatch.IDeliveryService" %>
    <%@ page import="com.oracle.bpel.client.util.Parameters" %>
    <html>
    <head>
    <title>helloworld</title>
    </head>
    <%
    String name=request.getParameter("name");
    if(name==null)
    name="BPEL";
    String xml ="<name xmlns=\"http://xmlns.oracle.com/helloworld\">" + name + "</name>";
    Locator locator = new Locator("default","helloworld");
    com.oracle.bpel.client.dispatch.IDeliveryService deliveryService = (com.oracle.bpel.client.dispatch.IDeliveryService) locator.lookupService(com.oracle.bpel.client.dispatch.IDeliveryService.SERVICE_NAME);
    com.oracle.bpel.client.NormalizedMessage nm = new com.oracle.bpel.client.NormalizedMessage();
    nm.addPart("payload",xml);
    deliveryService.post("helloworld","intiate",nm);
    out.println("BPELprocess helloWorld intiated");
    %>
    </html>
    i compiled this it is error free but when i try to run this i got a 500 internal server error whats the problem i dont if any one knows pls help me out.
    im new to bpel.
    the error is
    500 Internal Server Error
    java.lang.Exception: Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.rmi.RMIServerContext.lookup(RMIServerContext.java:207)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:255)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationContext.lookup(ApplicationContext.java:195)     at javax.naming.InitialContext.lookup(InitialContext.java:351)     at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)     at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:149)     at _helloworld._jspService(_helloworld.java:63)     [helloworld.jsp]     at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)     at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)     at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)     at java.lang.Thread.run(Thread.java:595)".     at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:82)     at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:149)     at helloworld.jspService(_helloworld.java:63)     [helloworld.jsp]     at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)     at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)     at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)     at java.lang.Thread.run(Thread.java:595)Caused by: java.lang.Exception: Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.rmi.RMIServerContext.lookup(RMIServerContext.java:207)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:255)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationContext.lookup(ApplicationContext.java:195)     at javax.naming.InitialContext.lookup(InitialContext.java:351)     at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)     at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)     at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:149)     at _helloworld._jspService(_helloworld.java:63)     [helloworld.jsp]     at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)     at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)     at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)     at java.lang.Thread.run(Thread.java:595)".     at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:293)     at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)     ... 21 more

    Looks like you are hitting some bug on 10.1.3.1.0, have you tried on a higher version and also referred SOA_ORACLE_HOME\bpel\samples\tutorials\102.InvokingProcesses\jsp sample ?

  • How to get an ArrayList Object in servlet from JSP?

    How to get an ArrayList Object in servlet from JSP?
    hi all
    please give the solution for this without using session and application...
    In test1.jsp file
    i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
    After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
    ---------Code----------
    <jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
    <jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
    <%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
    <jsp:setProperty name="payment" property="strDate" param="expirationDate" />
    <jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
    <%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
    <jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
    <jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
    <jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
    <%
    lis.add(payment);
    %>
    </jsp:useBean>
    <%
    request.setAttribute("lis1",lis);
    %>
    -----------Code in JSP-----------------
    In testServlet.java
    i tried to get the arraylist object in servlet using request.getAttribute
    But I unable to get that arrayObject in servlet.....
    So if any one help me out in this, it will be very helpfull to me..
    Thanks in Advance
    Edward

    Hi,
    Im also facing the similar problen
    pls anybody help..
    thax in advance....
    Litty

  • Error in accessing servlet from JSP

    Hello everybody,
    When I access a servlet from a JSP page,I am getting the following error message :
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.
    I am using Weblogic 7.0 and my web.xml code is as follows:
    <web-app>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/TestServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    I am accessing the servlet from a javascript function in my JSP page.
    I am quite new to the Java technology. So any help in this regard would be highly appreciated.
    Thanks in advance,

    The form action event is in a javascript function. I am sorry I mentioned that I am accessing this servlet from JSP. Actually,this servlet is accessed from an HTML document.
    The following is the javascript code:
    <script language="javascript">
    function lfnCallNext()
         alert("In the function");
         frmMain.method="POST";
         frmMain.action="/TestServlet";
         frmMain.hidChoice.value="GetList";
         frmMain.submit();
    </script>
    And this function is called from an hyperlink as follows:
    Work with Employee Database
    Thanks,

  • Wot all ways are there to call servlet from jsp

    hi all
    i want to know wot all methods are available
    so that i can call servlet from jsp
    the one which i know is using RequestDispatcher
    wot are others ?
    thanx

    hi all
    i want to know wot all methods are available
    so that i can call servlet from jsp
    the one which i know is using RequestDispatcher
    wot are others ?
    thanxhi here are few ways... to call servlet from jsp...
    these are just generic syntax.
    Form:     
    <form action="ServletPath">
    Link:     
    Directives & Action tags :
    <%@ page import="ServletPath" %>
         <%@ taglib uri="ServletPth" %>
         <jsp:include page="ServletPath">
         <jsp:forward page="ServletPath">
         <jsp:useBean class="ServletPath"> (Not sure about this useBean)
    hope you got your answer.
    regards,
    immu

  • How to call Servlet from jsp page and how to run this app using tomcat..?

    Hi ,
    I wanted to call servlet from jsp action i.e. on submit button of JSP call LoginServlet.Java file.
    Please tell me how to do this into jsp page..?
    Also i wanted to execute this application using tomcat.
    Please tell me how to do this...? what setting are required for this...? what will be url ..??
    Thanks.

    well....my problem is as follows:
    whenever i type...... http://localhost:8080/appName/
    i am getting 404 error.....it is not calling to login.jsp (default jsp)
    but when i type......http://localhost:8080/appName/login.do........it executes servlet properly.
    Basically this 'login.do' is form action (form action='/login.do').....and i wanted to execute this from login jsp only.(from submit button)
    In short can anyone please tell me how to diaplay jsp page using tomcat 5.5
    plz help me.

  • Very urgent: call servlet from JSP

    Hello,
    I'm facing a problem in invoking a servlet from a JSP having the JSF components.
    The application has a text field to implement ajax for search functionality in the database .I have written a servlet to make the database connection and fire the querry.
    Ajax implementation in a js file is called on every keyup event in the jsp file,and
    a call is given to the servlet from the ajax methode.
    The function in the js file is as follows:-
    function getPersonByFirstNameXML( firstName ) {
        if (!firstName) {
            clearPersonByFirstNameXML();
        } else {   
            var url = BASE_URL + "/servlet/get_PersonsXML";
            alert(url);
            return new AJAXRequest("post", url, "firstName=" + encode(firstName), processGetPersonByFirstNameXML);
    }Im getting the myAJAX.status value as 500.
    I think I'm not able to access the servlet properly.
    what changes do i need to make in the we.xml file ?
    and what should be the url to be passed.
    Please provide me a sloution to the above problem as it is very urgent else if anybody is aware of a readymade JSF componet with search functionality freely available please let me know.
    PS:
    The sample application named RedirectionExample which makes use of a servlet and would be of help to you. You can find the tutorial on the following page:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    is not available as stated in some of the suggestions by Author: mayagiri
    Thanks for any help.
    Abhi

    the status 500 generally means either HTTP server internal error or that execution of CGI script or servlet aborted with error.
    It can be reasonably supposed that the request reaches the servlet, ie. that "url" value points to some existing servlet, otherwise most probably the status value would be 404.
    To test that the servlet is working i'd try to access it using some simple html page with form like this (with {BASE_URL} replaced by real value):
    <form method=post action={BASE_URL}/servlet/get_PersonsXML>
    <input type=text name=firstName>
    <input type=Submit>
    </form>

  • Referring to Servlet from JSP

              Hi, I created a new web project in my workshop application and also created the
              directory structure: WEB-INF/src/mypackage/ to store all the java classes related
              to servlets and beans of my web project. I have a jsp page with few form fields
              whose submit action should invoke a servlet stored in /src/mypackage. How do I
              refer to the servlet in the JSP page that gets invoked on submit action?? [ form
              tag removed <!--- form action="???/MyServlet" method="POST"> ]. I am not sure
              where all the java class files are stored when I build the application using workshop.
              Another question I have is whether the build application will automatically include
              all the required servlets and taglibs in the web.xml file or this has to be done
              explicitly using Weblogic Builder?
              Thanks...
              

    How are you trying to create the link to the servlet? Are you using any
    tags?
    Subbu
    Christian Schlaefcke wrote:
    Hi Folks,
    I need set a servlet that produces an image output as source for an "img" tag in a jsp. I found several examples how this should be done with a simple webapp and these examples work right away in a simple tomcat environment.
    But BEA Portals are not comparable with simple webapps in combination with tomcat. The URLs for example are rendered in a special way, for example:
    http://localhost:7001/MyWebApp/My.portal?_nfpb=true&portlet_27_1_actionOverride=/portlets/Level1/aPortal/portalPage&portlet_27_1do_action=null
    My Problem:
    When I try to refer to my servlet like this
    img src="/servlet/ImageRenderServlet"
    The image is not rendered because the URL is not rendered. Even when I leave away the leading "/" of the servlet it becomes:
    http://localhost:7001/MyWebApp/servlet/ImageRenderServlet
    So whats the trick when referencing servlets from a jsp that belongs to a BEA Portlet?
    Thanks for any Help!
    Regards,
    Chris

  • How to call servlet from jsp

    i m trying to call it from jsp using
    <a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
    but its giving error..
    type Status report
    message HTTP method GET is not supported by this URL
    description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

    i m trying to call it from jsp using
    <a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
    but its giving error..
    type Status report
    message HTTP method GET is not supported by this URL
    description The specified HTTP method is not allowed
    for the requested resource (HTTP method GET is not
    supported by this URL).Are you implementing the doGet or doPost method in your servlet? If you are calling from a hyperlink then it needs to be implementing the GET method. To access the POST method use a html form.

  • Import a servlet from JSP without the use of a .JAR

    Migrating web app from NT / iPlanet 4.1 to Solaris / iPlanet 4.1.
    I've created a Web app in which JSPs utilize Servlets stored in a JAR file. I am now moving the app to a server that I do not control. I wish to configure the app in such a way that I will be able to modify the servlets and not have to restart the Web server to see the changes. I assume the only way to do this is to remove them from the JAR file.
    I'm familiar with how to package servlets in JAR files and use them in JSPs, but can't figure out how to import (my own) servlets from outside the JAR file. Is there any way to do this without specifying the servlet in the CLASSPATH?
    ...sorry if it's a stupid question, I'm not a Java programmer. Thanks in advance. Please let me know if I have not given enough detail.

    I've created a Web app in which JSPs utilize Servlets
    stored in a JAR file. I am now moving the app to a
    server that I do not control. I wish to configure the
    app in such a way that I will be able to modify the
    servlets and not have to restart the Web server to see
    the changes. I assume the only way to do this is to
    remove them from the JAR file.Bad assumption! This will have no impact on reloading the servlets!
    What you are asking for is called 'hot deployment'. Not all servers do that.
    Tomcat 4 does for instance, but you have to configure it for your specific webapp to be able to use it.
    Hot deployment just reloads all the classes in its classpath, it doesn't matter if they're in jars or just .class

  • Invoking webflow from JSP

    Does anyone know if there is a method for programmatically invoking a webflow from
    a jsp? I have a jsp that has multiple "modes", for instance, it posts to itself
    and will do one of 3 things "action1", "action2", or "action3".
    I want the jsp to mimic a redirect and go to the page associated with action1,
    2 or 3.
    i saw the method invokePortletWebflow in PortalAppflowHelper but am not sure what
    it really does.
    thanks

    Hello,
    You should use the webflow JSP tag library to create webflow URLs that
    will forward the request to. Look at the <webflow:createWebflowURL> tag.
    If you want to do a redirect instead of a forward to the destination JSP,
    then set doRedirect="true".
    What you would do is set event="mystuff.action1" and you would create a
    webflow, using the EBCC, that links the "mystuff.action1" event from your
    origin JSP to your action1 JSP page. Similarly for action2, action3.
    If you are doing this in the context of a portlet that is in a portal,
    then you should look at the <portlet:createWebflowURL> tag. Because the
    portlet webflow is executed within the overall portal webflow, you must use
    this tag to set the portletId and a few other things. You would create a
    separate portlet webflow that would be very similar to the webflow I
    describe above.
    See the webflow taglib docs at
    http://edocs.bea.com/wlp/docs70/jsp/navigat.htm#998197
    See the portlet taglib docs at
    http://edocs.bea.com/wlp/docs70/jsp/mngprtal.htm#1001597
    I would also recommend the "Setting Up Portal Navigation" doc at
    http://edocs.bea.com/wlp/docs70/dev/navigate.htm
    Let me know if you have any trouble creating your webflow and using the
    createWebflowURL tag.
    "B Hogan" <[email protected]> wrote in message
    news:[email protected]..
    >
    Does anyone know if there is a method for programmatically invoking awebflow from
    a jsp? I have a jsp that has multiple "modes", for instance, it posts toitself
    and will do one of 3 things "action1", "action2", or "action3".
    I want the jsp to mimic a redirect and go to the page associated withaction1,
    2 or 3.
    i saw the method invokePortletWebflow in PortalAppflowHelper but am notsure what
    it really does.
    thanks

  • Invoking servlet from mDB

    Hi all;
    this is the process.
    1. Servlet received / creates msg.
    2. Servlet Enqueues Msg on JMS queue.
    3. MDB dequeues.
    -- processes against DB
    -- composes respoonse.
    4. mdb invokes servlet with response.
    servlet need not maintain state.
    State information can be passed in Msg (Query and Response)
    I was just wanting to find out if this possible in oc4j.
    apparently, there is a process in weblogic 6.1 to support this.
    Any help is appreciated.
    thanks.
    jayant

    I would assume that you would need to do a "createSipApplicationSession" on your sip factory and then get the ID from there.
    Then create a request from your session and send it.
    Wouldn't you want each outgoing call to be associated with a different sip app session?

  • Invoking Forms from JSP and Vice versa

    Hi,
    I am in to a requirement like invoking a screen developed using Oracle Forms 6i from JSP and vice versa.
    1. Could you please anybody help to get the documents to be refered to get more idea on this?
    2. Is it possible only by Oracle ADF?
    Please help me on this.
    Thanks & Regards
    M Thiyagarajan

    Hi All,
    Thanks a lot for the clarifications.
    Actually, integration should happen between forms and JSP. Parameters need to be passed to and forth. I will go through the specified link.
    Also could you please clarify me where exactly, ADF comes into picture? or what are all the advantages when we go for ADF?
    Thanks & Regards
    M Thiyagarajan

  • WL10 generated servlets from jsp pages

    hi!
    I'm looking for .java servlet files automatically generated from JSP (Weblogic 10). Do anybony know where can I find this files?
    Thanks in advace,
    Bartek

    Well, Servlet and JSP both are server side technologies and both can be used in web applications. You can write web pages using both servlet and JSP. In fact, your JSP pages are converted to Servlet by container while serving requests. However, writing a JSP page is relatively easier and requires minimal Java knowledge.
    When you will develop real world java based web applications you will find that you are writing more JSP pages than servlet.
    In a typical MVC (Model View Controller) architecture a single servlet is used as controller and JSP pages are used to generate web content.
    Thanks,
    Mrityunjoy

Maybe you are looking for

  • 1st generation iPod not recognized by iTunes 9

    Hullo: Recently upgraded to iTunes 9 and found that it doesn't recognize my iPod Shuffle (1st gen). The iPod shows up on My Computer, and it still plays and charges when connected, but it simply never appears on the Devices tab on iTunes (in fact, th

  • How do I change the text color in a call out box?

    How do I change the text color in a call out box?

  • HELP ios 5.0.1 bug contacts

    I currently have an iPhone 4s and of course the ios 5.0.0. was preinstalled with ATT network, with no real problems.  I update this program Over the Air (OTA) with 5.0.1 and lost all my contacts and bad battery life now.  I get my contacts from Yahoo

  • Font  Capture Error on launching Illustrator CS3

    Hi When i try to launch Illustrator CS i always get this error and then the program crashes. FONT CAPTURE:ILLUSTRATOR.EXE - FATAL APPLICATION EXIT The specified module could not be found. C:\Program Files\Common Files\Adobe\Adobe Version Cue CS3\Clie

  • How to install Jserver

    I am trying to run the following pl/sql where in i want to send an email . DECLARE l_mailhost VARCHAR2(64) := 'mail.mycompany.com'; l_from VARCHAR2(64) := '[email protected]'; l_to VARCHAR2(64) := '[email protected]'; l_mail_conn UTL_SMTP.connection;