Accessing Servlets from JSPs

Hi!
I'm developing a web application with JSPs and servlets using JDeveloper 3.2.
With the integrated web-to-go web server I can either start a JSP environment or a servlet environment.
My question: What do I have to do to start the JSP environment with access to servlets?
I tried to start the wizard Web Object Manager, but I get the error message "Could not load servlet information from Web Server". When I try to register a Servlet in this wizard, it will hang up.
What's wrong? Are there any other possibilities to configure the web-to-go web server, so that I can access JSPs and servlets?
Thanks for your help!
Brian

Hi!
I finally found the solution myself.
The problem was that the entry "HTML source" under "Project Properties" was empty. I entered "servlets" and started the "Web Object Manager" without any problem. My servlet was registered and I could access it from my JSP.
I hope that you can benifits from my experience.
Cu
Brian

Similar Messages

  • 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,

  • Error when accessing Entity from JSP

    I'm trying to develop an application in Jboss AS.
    I have an Entity Class named Users and a stateful session named LoginActionBean which has the following method:
      public Users checkUser(String t1,String t2){
             Users test = (Users) em.createNamedQuery("Users.login").setParameter("userUsername",t1).setParameter("userPwd",t2).getSingleResult();
                return test;
        }In my jsp file, I try to do the following:
    Users a;
    public void jspInit() {
        try {
            InitialContext ic = new InitialContext();
            bci = (LoginActionLocal) ic.lookup("deytera_pasxa/LoginActionBean/local");
        } catch (Exception ex) {
            System.out.println("Error:"+
                    ex.getMessage());
    try {
        s2 = request.getParameter("username");
        s3 = request.getParameter("password");
        if (s2 != null && s3 != null) {
                a = bci.checkUser(s2,s3);
    .....I get no compilation error but when I try to run it I get:
    20:28:08,650 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.NoSuchMethodError: ejb.LoginActionLocal.checkUser(Ljava/lang/String;Ljava/lang/String;)Lejb/Users;
            at org.apache.jsp.isLogged_jsp._jspService(isLogged_jsp.java:90)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            at java.lang.Thread.run(Thread.java:595)at the moment checkUser() is called. If I change the method's return type to let's say boolean and change the code, it works perfectly fine!
    I'm stuck here for 3 hours, any help much appreciated.
    Edited by: SyMpToM on May 5, 2008 11:03 AM
    Edited by: SyMpToM on May 5, 2008 11:04 AM

    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,

  • 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

  • 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.

  • 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.

  • 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>

  • 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.

  • Accessing Servlet by jsp: forward

    I want to access Servelt by hyperlink in a jsp web site
    connection.jsp
    <%@ page contentType="text/html;charset=GB2312" %>
    <HTML>
    <BODY bgcolor=cyan><Font size=1>
    <A Href="/myjsp/Hello" >Accessing servlet<A>
    </BODY>
    </HTMLi put the bean in the dir(/myjsp/WEB-INF/classes/hello(package)/Hello)
    and modify the file web.xml like this:
    <servlet>
            <servlet-name>Hello</servlet-name>
            <servlet-class>hello.Hello</servlet-class>
        </servlet>
        <servlet-mapping>
           <servlet-name>Hello</servlet-name>
           <url-pattern>/Hello</url-pattern>
        </servlet-mapping>it works!
    but if i use <jsp:forward>
    <html>
         <body bgcolor="green">
         <jsp:forward page="/myjsp/Hello" />
         <body>
    </html>it causes an Exception The requested resource (/myjsp/myjsp/SimpleServlet) is not available.
    why? why the path have /myjsp/myjsp....?
    Thanks

    only one wrong u have done that is
    U have to give :
    <jsp:forward page="/Hello"></jsp:forward>
    but not
    <jsp:forward page="/myjsp/Hello"></jsp:forward>
    the reason is that when u run a jsp file , a servlet is generated for that
    jsp file. so calling a another servlet from that servlet(servlet of connection.jsp) can be done by just giving url -pattern. No need to give
    /myjsp/Hello .
    regards,
    reply after u get

  • 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

  • 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

  • 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

  • Error Failed to load database information - access report from jsp in linux

    Hi,
    While accessing the report from my jsp file I got the below error. I am using Crystal Report Server 2008 V1 in linux environment.
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Failed to load database information.
    Error in File rpt_dp_customer_stmt {9515FCCB-0245-11E0-9DA4-000C29D5AD7D}.rpt:
    Failed to load database information.---- Error code:-2147482931 Error code name:failed
         com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwReportSDKServerException(Unknown Source)
         com.crystaldecisions.proxy.remoteagent.s.a(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.z.a(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.ak.if(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.ad.int(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.bk.for(Unknown Source)
         com.crystaldecisions.proxy.remoteagent.v.a(Unknown Source)
         com.crystaldecisions.proxy.remoteagent.v.if(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
         com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(Unknown Source)
         org.apache.jsp.formula_jsp._jspService(formula_jsp.java:117)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Moreover, in my jsp i am passing the data base parameter like below,
    PropertyBag logonProperties = new PropertyBag();;
        mainPB.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, logonProperties);
        mainPB.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, "libcrdb_jdbc.so");
        logonProperties.put("Database Class Name", "oracle.jdbc.driver.OracleDriver");
        logonProperties.put("Use JDBC", "true");
        logonProperties.put("Connection URL", url);
        logonProperties.put("Server", dbserver);
    Also I set the LD_LIBRARY_PATH in linux machine, because i have the libcrdb_jdbc.so file on that path.
    /home/ReportServer/bobje/enterprise120/linux_x86/crpe/

    Its working. I gave crdb_jdbc.dll name in the connection info

  • Not going to Servlet from JSP

              Hi,
              I have written a program that takes the email id and password from a jsp page and posts it to a servlet. The servlet had to get the parameters from the jsp and pass this values to a method called loginvalidation which inturn has to connect to data source and return true if the record exists else false if it doesn't exist. Now my problem is that the control is not passed from the jsp to the servlet(name:Login). It throws an Illegal access exception. What can be the problem? Can u provide a solution for this.
              

    The problem here is that your servlet doesn't implement doGet()
    doing a response.sendRedirect sends a web page back to the client, which then tries to load the servlet.
    It uses GET instead of POST because it is a standard URL link.
    Solution: implement doGet() in your servlet, even if all it does is call doPost() to do the same thing.
    You can also do a jsp:include, or jsp:forward to transfer control from a jsp to a servlet.
    However you are working in HTML, and you may not be able to get away from using an HTML form.
    Cheers,
    evnafets

Maybe you are looking for

  • Intel HDMI problem

    MB:         MSI B75MA (VGA+HDMI) CPU:       i5 3330 RAM:       2x4GB DDR3 HDD:       Samsung 500GB Monitor:  Samsung 206 BW (1680x1050) VGA/DVI TV:          LG 32LK330 (1366x768) HDMI OS:    Win 7 Ultimate 64-bit Video driver version  9.17.10.2932 (1

  • ITunes lip-syncing issues,

    Hi there, I was wondering if anyone can help me. I have recently bought a new laptop (inspiron 17R special edition) because of its supposed brilliance in media centre. However I have downloaded iTunes and my movies and the lip syncing is all out, I h

  • Condition  Idoc COND_A02

    Hi, I am using BLAORD03 and COND_A02 IDOC to upload (INBOUND) the contract data as well condition data through custom program. But after posting both IDOC, the price given in condition record is not reflecting to the net price of line item screen of

  • Crystal Report Server 2008 Embedded RAS Error

    We have installed crystal server 2008 embedded on a Microsoft 2008 server 64 bit box, with no error being reported during the install. No updates or patches have been applied and we selected the default installation. We then have been attemping to ru

  • Como cambiar voiceOver de idioma?