Consuming a Web Service using JSP and servlet

I have created a Web Service in Netbeans IDE 5.5. I developed a JSP to provide input to the Web Service, and a servlet that will pass the input to the web service through a request and outputs the result.
I am getting the following error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet TestServlet threw exception
root cause
java.lang.RuntimeException: WEB5002: Exception in handleBeforeEvent.
root cause
com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: test.org.TestServlet/service@Field-Injectable Resource. Class name = test.org.TestServlet Field name=[email protected]@@@ into class test.org.TestServlet
root cause
javax.naming.NamingException [Root exception is java.lang.reflect.InvocationTargetException]
root cause
java.lang.reflect.InvocationTargetException
root cause
javax.xml.ws.WebServiceException: java.io.FileNotFoundException: http://localhost:8080/TestWebApplication/TestWSService?wsdl
root cause
java.io.FileNotFoundException: http://localhost:8080/TestWebApplication/TestWSService?wsdl
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server Platform Edition 9.0_01 logs.
Any hints???

You probably should post to either the NetBeans website mailing list, or the Sun forum that supports the Sun Application Server, as the error is the result of a configuration error of one or both of these products. A file can't be found:
java.io.FileNotFoundException: http://localhost:8080/TestWebApplication/TestWSService?wsdl
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server Platform Edition 9.0_01 logs.
These forums are for support of the Java language.

Similar Messages

  • Consuming a Web Service in JSP

    Hi All,
    I have exposed a BAPI as a web service using the material available on SDN, I had searched a lot but I am not able to find a satisfactory material which guides about how to consume this web service in a JSP page, can somebody help me in this regard.
    Regards
    Sid

    Hai,
    Create a new project of type web services under that select deployable proxy.
    right click on the project new client proxy definition for the web service .
    use that generated proxy classes in your jsp.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2188ae5-0601-0010-dd93-c23e381ef41e
    otherwise
    /people/abhijeet.jangam/blog/2006/05/27/developing-single-document-wsdl-to-schedule-a-web-service
    regards,
    null
    Message was edited by:
            Naga Raju Meesala

  • Interesting single sigon application project using jsp and servlet....Help.

    A customer login's to my website using Enterprise login. I am supposed to have a link on my website to this other website(that also uses our Enterprise login details but hosted by other vendor/company on their server), and when I click this link the customes should automatically get logged in to this other website and get a welcome page(instead of login page).
    Below are the sequence of steps that the other website wants me to perform to get to his welcome page(i.e bypass his login page).
    FYI, I am planning to build a jsp page with a link to this other website. Can some body tell me how should I build the application(i.e) how jsp and servlets be build to interact to perform these operations. Any hep is greatly appreciated.
    1.When a user clicks on to other website link(available on my website), the browser generates an HTTP GET request to the Other website's session servlet. User's name is one of the parameters of this request.
    2.Other website receives the HTTP request and generates a unique session identifier for this user. An HTTP response to the end-user is then sent. The user's name and the session identifier are passed back as parameters in the redirect URL.
    3.The browser sends the HTTP request (GET) to the Verification Service that was specified in the redirect message. The parameters (user name and/or session id) will be passed as URL parameters.
    4.The Verification Service(of other website) authenticates the user. A redirect URL to it's sigon servlet(with parameter's User id and key) is then sent back to the user's browser.
    5.The end-user's browser will perform the redirect (performing an HTTP get operation to Other website's signon servlet with the username and the digest key).
    6.The other website will check if the parameter's passed is the same as the one passed earlier, if the user is who he says he is then he is redirected to the main page of the application.
    7.The browser will then redirect the user to Other website's main page (welcome.jsp).
    There seems's to be many calls to this other website that needs to be performed behind the scenes once a user clicks the link on my website.
    Please suggest and help me out.........
    Edited by: 836726 on Feb 21, 2011 3:41 PM

    Why are you trying to build a whole federated single sign on framework from scratch when you can just use/buy an existing and proven solution instead? There are a lot of security implication and trust issues involved for this so unless you already understand all of those I'd advise you not to re-invent the wheel. There are a lot of products available that do this. Try searching for '<vendor name> Access Manager' or OpenSSO.

  • Consuming an External Web Service using HTTPS and WS Security

    Hello everyone,
    I'm having a problem setting the security information in a SOAP header using a generated ABAP Client Proxy to consume an external web service that requires a User ID and Password in the Header section of the SOAP message.  I need to use HTTPS. I'm on a WAS 7.01 SP08 system so from my readings, SAP is supposed to be able to add the username and password into the header section of the message.  I can't seem to get SAP to add this information added to the header.
    Here are the steps that I have taken to set the security values.
    1) Created the client proxy from the WSDL in SE80.  Basic Authentication on the Configuration tab was turned on automatically.
           Note, Transport Security is set to None.  I cannot change it.
    2) Created an outbound set user name profile in transaction WSPROFILE with the appropriate username and password.
    3) Added the profile to the default port in transaction LPCONFIG as an outbound under the WS Security section of the screen.
    When I called the external Web Service, I got back the following error message:
    com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5509E: A security token whose type is [http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken] is required.
    So, after reading through this Forum, I saw that I needed to use the SOAMANAGER.  I set up a Proxy in the SOAMANAGER and manually created the Logical Port.  This was the only way I could figure out how to set the Authentication Settings in the Logical Port to "User ID / Password".  I then entered the User ID and Password.
    However, I am still getting the same error message.  I feel I am close but missing some small configuration to tell SAP to use WS Security with a Username token.
    I'm not sure what I'm doing wrong, so any help would be appreciated.
    Thanks,
    Stephen

    I had this error again so I thought I would post my solution:
    The issue is SAP needs to know the certificates being used by the web site being called.  These certificates are automatically installed in your browser but need to be manually installed in SAP.  This is what I did:
    How to find/install new certificates
    Make sure you run Internet Explorer as an Administrator so you can export the certificates
    Go to the web site that SAP is trying to call in Internet Explorer
    Double click on the lock in the address bar
    View certificates
    Find the certificates that are being used
    Tools --> Internet Options --> Content --> Certificates
    Click on the “Trusted Root Certification Authorities” tab
    Find the certificate identified in step iii
    Export as a CER certificate
    Click on the “Intermediate Certification Authorities” tab
    Find the certificate identified in step iii
    Export as a CER certificate
    Go to STRUST in SAP
    Import the Certificates in the “Anonymous” or “Standard” SSL client
    Save
    RESTART the ICM via t-code SMICM  <-- Critical!!!
    Test

  • Errors trying to Invoke web service using BES and SIF

    Moved this up from the Integration Forum to see if I can get some visibility on it.
    Description : When an invoice get's approved we need to pass on the details of the invoice and approval to the 3rd party customer.
    So far I have been able to test the business event which calls the web service that writes the information to a file. However, although the file is created there is no content in the file.
    So the steps up to this point
    1. Create a simple web service that takes a string as an input parameter and writes this out to a file.
    2. Locate the Approve Invoice event [oracle.apps.ap.event.invoice.approval] and add a new subscription that will invoke my web service.
    I have a number of issues at the moment.
    From the business event page I can test the event which writes a record to the wf_java_deferred queue. I have been able to call the service and create a file however that seems to have stopped working. Where do I look to see what's going wrong? Is the diagnostics the best place to start
    If I go into Status Monitoring I can see the last Business Event test I did is now having errors when it tries to invoke the web service. The error I get is
    Error Activity ID          
    Error Activity Label          
    Error Assigned User          
    Error Item Type          
    Error Item Key          
    Error User Key          
    Error Message          oracle.apps.fnd.wf.bes.InvokerException: Event payload is not available
    Error Name          
    Error Notification ID          
    Error Result Code          
    Error Stack          oracle.apps.fnd.wf.bes.InvokerException: Event payload is not available at oracle.apps.fnd.wf.bes.WebServiceInvokerSubscription.onBusinessEvent(WebServiceInvokerSubscription.java:236) at
    oracle.apps.fnd.wf.bes.EventDispatcher.executeSubscription(EventDispatcher.java:870) at oracle.apps.fnd.wf.bes.EventDispatcher.processSubscription(EventDispatcher.java:556) at
    oracle.apps.fnd.wf.bes.EventDispatcher.dispatch(EventDispatcher.java:335) at oracle.apps.fnd.wf.bes.AgentListenerProcessorNew.processMessage(AgentListenerProcessorNew.java:373) at
    oracle.apps.fnd.cp.gsc.SvcComponentProcessor.process(SvcComponentProcessor.java:659) at oracle.apps.fnd.cp.gsc.Processor.run(Processor.java:283) at java.lang.Thread.run(Thread.java:619)
    Error Monitor URL          
    Timeout Value          0
    Event Name          oracle.apps.ap.event.invoice.approval
    Event Details          PLSQL:WF_STANDARD.EVENTDETAILS/WFERROR:332124
    Event Message          View Event Message
    Event Key          3134525_1
    Event Data URL     http://hostname.co.nz:8000/OA_HTML/RF.jsp?function_id=18157&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&
    params=.tut9vCLHp8BRzYkdaLWV3ekOnBGTRSUSr1RYBqw0ISKruqT5nAzoOSzIkWSQrzWO8z23dyX31GlRw75r21ich1KC4hE2KL.ZedjIDcPalm8f.akDClydWkRR3w2eGuk
    Event Subscription http://hostname:8000/OA_HTML/RF.jsp?function_id=26058&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&
    params=fR9VOZbtfJEdYQNb645CRU3kD39os3CZwt7XUpbOYb1RImgFkWaeDFEV0SCaVn1M
    Error Type          UNEXPECTED
    Error Details          PLSQL:WF_STANDARD.ErrorDetails/WFERROR:332124
    Administrator Role          SYSADMIN
    Subscription Details          PLSQL:WF_STANDARD.SubscriptionDetails/WFERROR:332124
    Error Person ID          
    Error Person Username          
    How do I get access to the payload? I only really need 2 or 3 items at this time. Do I need to extend a seeded java function? For example in my initial tests I only want to pass across the Invoice Id so how do I get the value of this attribute out of the wf_event_t (Is this the correct object name) and into the payload that is being passed across to the service call.
    Cheers
    Owen

    Hello Owen
    I am experiencing the exact same issue as you are (missing payload) when invoking a web service and was wondering if you have resolved this issue or gotten any new useful information?
    Regards,
    Magnus

  • Implementing  jdbc using jsp and servlets

    please give me documnetation and few programs with code .
    implementing or using jdbc with servlets and jsp.

    please give me documnetation and few programs with
    code .
    implementing or using jdbc with servlets and jsp.Well, which do you want to do? Implement JDBC with servlets and JSP - a tricky job, but there's no technical reason why you couldn't for instance write a class which both extends HttpServlet and implements java.sql.Driver. Wouldn't recommend it, though

  • Special Character in Web Service using OAS and Weblogic

    In the project, we are using OAS be the app server, all the "<" in the context of xml in web service are converted to "&lt;" automatically.
    However, when we deploy it to weblogic, the "<" was converted to "&<;&"
    Then another app try to unmarshalling it, but the app cannot handle the < the throw the exception. Do you know why the how to change it back to "&lt;"?
    OAS version:10.1.3.2.0
    Weblogic version:11gR1
    Spring Version:2.5
    OAS XML
    <?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <makeHTMLStrForAwardServiceResponse xmlns="http://com.makeHTMLStrForAward/types/">
    <htmlStr>&lt;html>&lt;head>&lt;style type="text/css">
    &lt;/html>
    </htmlStr>
    </makeHTMLStrForAwardServiceResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    Weblogic XML
    <?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <makeHTMLStrForAwardServiceResponse xmlns="http://com.makeHTMLStrForAward/types/">
    <htmlStr>&<;&html>;&<;&head>;&<;&style type="text/css">
    ;&<;&/html>;</htmlStr>
    </makeHTMLStrForAwardServiceResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    Edited by: user1287019 on Apr 20, 2011 10:13 AM

    Ha Ha,
    I found that one of the Spring WS lib we were using is 1.5.4.
    It seems OAS ship with WS lib and the app use the OAS lib.
    But weblogic did not have WS lib, then app need to use it's own lib. Then problem occur.
    After change to version 1.5.8, the problem solved.

  • Consuming a web service using UTL_HTTP, Complex XML types

    this is the first time i have encountered a complex type calling a web service from PLSQL. i have sucsessfully called other methods from this same web service so i know its working.
    this is what i have to pass in:
    <xs:complexType name="AddJobRequestStructure">
    <xs:sequence>
    <xs:element name="AffectedUnits" type="ro:UnitIdentificationStructureArray" />
    <xs:element name="ServiceCode" type="xs:string" />
    <xs:element name="RecordTypeCode" type="xs:string" />
    <xs:element name="MultipleDescriptionCodes" type="ro:DescriptionSeverityStructureArray" />
    </xs:sequence>
    </xs:complexType>
    concentraiting on the parameter "AffectedUnits" type =
    <xs:complexType name="UnitIdentificationStructure">
    <xs:sequence>
    <xs:element name="UnitID" type="xs:string" />
    <xs:element name="StreetID" type="xs:string" />
    <xs:element name="UniqueStreetReferenceNumber" type="xs:string" />
    <xs:element name="UnitNumber" type="xs:string" />
    <xs:element name="Location" type="xs:string" />
    <xs:element name="PAON" type="ro:AONstructure" />
    <xs:element name="Easting" type="xs:double" />
    <xs:element name="Northing" type="xs:double" />
    </xs:sequence>
    </xs:complexType>
    for simple types i build the XML such as:
    request.body := request.body||'<ServiceCode xsi:type="xs:string">'||some_value||'</ServiceCode>';
    (request being a type that holds the namespace,method,body and envelope tag)
    just to re-itterate, i have other web service methods (from the same web service) working this way, however im not sure where to start with this complex type, so any help would be great
    Cheers.

    Thanks for the response, I’m not familiar with XML or web services so I appreciate the input. There is indeed an intermediate type. The web service documentation I have does state that the complex type can take multiple records, however we will only ever be passing one, it was this mention of an array that threw me, i asumed the array was the complex type - rather than there being an array of complext types for the handling of multiple records.
    <xs:complexType name="UnitIdentificationStructureArray">
    <xs:complexContent>
    <xs:restriction base="soapenc:Array">
    <xs:sequence />
    <xs:attribute ref="soapenc:arrayType" n1:arrayType="ro:UnitIdentificationStructure[]" xmlns:n1="http://schemas.xmlsoap.org/wsdl/" />
    </xs:restriction>
    </xs:complexContent>
    </xs:complexType>
    I assumed I had to pass each element of the complex type in separately and then reference this somehow in the parent, but it sound like, from what you say, I can just pass in XML containing the data in the correct structure
    Could you give me a basic example of how this XML fragment might look?
    Apologies for the lack of understanding - XML is failry new to me, this is as far as i have got
    Cheers

  • Executing KSH shell scr thru web-page using JSP or servlets - req. assistan

    Hi - I have a shell scr which I regularly use thru UNIX terminal. It takes parameters like -stgdir=xxx, -abc, -def, etc. etc. and then kicks off processing whatever it's supposed to do. It does not run in the background, so in another screen I basically "tail" the logs. 2nd. script does the same but takes some user inputs interactively. Note that none of these scripts perform any sys admin activities, nor do they require root privileges.
    Priority is 1st. script - I was wondering if it's possible to build a servlet, which can invoke this script and thus I can deploy the servlet/jsp page combination in some web-server within the UNIX machine and be able to access it from my Windows PC, Firefox/IE. Once started, the servlet can do either (a) Provide a link which links to the log-file (b) Automatically do a page change and start showing the log-file.
    Is this possible and if yes if some help can be provided - much appreciated.
    2nd. script I believe would be a bit complex as the servlet need to capture user inputs and actually "mirror" the shell script queries back to the client. If any help can be rendered for this too, much appreciated.
    An important detail - the parameters for the 1st. script can not be hard-coded but need to be provided as an option to user, since the options can change with situation.
    Again - thanking you in advance.
    Edited by: baivab on Oct 9, 2008 1:29 AM

        ProcessBuilder pb1 = new ProcessBuilder("script1.sh "+param1+" "+param2);
        Process p1 = pb1.start();
        p1.waitFor()  // in case you want to wait for completion of the shell script
        ProcessBuilder pb2 = new ProcessBuilder("script2.sh "+param1+" "+param2);
        Process p2 = pb2.start();
        PrintWriter pw = new PrintWriter(p2.getOutputStream(), true);
        pw.println(input1);  // input1 is the input expected by the script2.shalso look at the API for ProcessBuilder and Process classes

  • Composing mail from email web application using jsp and custom tags

    here is the send.jsp file
    <%@ page language="java" %>
    <%@ page errorPage="errorpage.jsp" %>
    <%@ taglib uri="http://java.sun.com/products/javamail/demo/webapp"
    prefix="javamail" %>
    <html>
    <head>
         <title>JavaMail send</title>
    </head>
    <body bgcolor="white">
    hi
    <javamail:sendmail
    recipients="<%= request.getParameter(\"to\") %>"
    sender="<%= request.getParameter(\"from\") %>"
    subject="<%= request.getParameter(\"subject\") %>">
    <%= request.getParameter("text") %>
    </javamail:sendmail>
    <h1>Message sent successfully</h1>
    </body>
    </html>
    Here is the java file i.e used to refer to this custom tag
    package taglib;
    import java.util.*;
    import java.net.*;
    import javax.mail.*;
    import javax.mail.Authenticator;
    import javax.mail.internet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    * Custom tag for sending messages.
    public class SendTag extends BodyTagSupport {
    private String body;
    private String cc;
    private String host;
    private String recipients;
    private String sender;
    private String subject;
    * host attribute setter method.
    public void setHost(String host) {
    this.host = host;
    System.out.println("Host is : " +host);
    * recipient attribute setter method.
    public void setRecipients(String recipients) {
    this.recipients = recipients;
    System.out.println("recipients is " +recipients );
    * sender attribute setter method.
    public void setSender(String sender) {
    this.sender = sender;
    System.out.println("Sender is : " +sender);
    * cc attribute setter method.
    public void setCc(String cc) {
    this.cc = cc;
    * subject attribute setter method.
    public void setSubject(String subject) {
    this.subject = subject;
    System.out.println("subject is : " +subject);
    * Method for processing the end of the tag.
    public int doEndTag() throws JspException {
         System.out.println(" ** In do end tag");
    Properties props = System.getProperties();
    try {
    if (host != null)
    props.put("mail.smtp.host", host);
    else if (props.getProperty("mail.smtp.host") == null)
    props.put("mail.smtp.host", InetAddress.getLocalHost().
    getHostName());
    } catch (Exception ex) {
    throw new JspException(ex.getMessage());
    Session session = Session.getDefaultInstance(props,null);
         Message msg = new MimeMessage(session);
         InternetAddress[] toAddrs = null, ccAddrs = null;
    try {
         if (recipients != null) {
         toAddrs = InternetAddress.parse(recipients, false);
         msg.setRecipients(Message.RecipientType.TO, toAddrs);
         } else
         throw new JspException("No recipient address specified");
    if (sender != null)
    msg.setFrom(new InternetAddress(sender));
    else
    throw new JspException("No sender address specified");
         if (cc != null) {
    ccAddrs = InternetAddress.parse(cc, false);
         msg.setRecipients(Message.RecipientType.CC, ccAddrs);
         if (subject != null)
         msg.setSubject(subject);
         if ((body = getBodyContent().getString()) != null)
         msg.setText(body);
    else
    msg.setText("");
    Transport.send(msg);
    } catch (Exception ex) {
    throw new JspException(ex.getMessage());
    return(EVAL_PAGE);
    all the entries in taglib.tld and web.xml are correct.
    It is one of the article given at this url:
    http://java.sun.com/developer/technicalArticles/javaserverpages/emailapps/

    First, you should not take copyrighted code and post it without a copyright.
    The code you posted is copyright Sun Microsystems.
    Second, why did you post it? Did you have a question?

  • Showing various images on browser using JSP and Servlet

    Hello Guys!
    I am starting to develop in Java and already I am facing a big problem.
    If somebody will have some tip or suggestion, will be very well comings!
    The application must present in browser images originnally of format TIF. As it is not a native format of the I.E. , I converted the image for JPG (without saving it on disk) and send it to the browser a encoded image (encode) using JAI library in one servlet had access by a JSP. Then, the structure of my application is thus:
    1) an archive JSP draws the initial screen in browser and presents one input text.
    2) later that the user places the parameter, I make an access to the database and read a quantity of images to be presented.
    3) From there in the proper JSP, I use de tag img src to send image to the browser in agreement archive the amount of images.
    It follows the code of the JSP:
    <% 
                    int intI=0;
                    int intCont=0;
                    if(blnImagem == true){
                        out.println("<br>");
                        out.println("<table border=0 STYLE=border-collapse:collapse>");
                        out.println("<tr>");
                        for(intI=0;intI < Processo.intQtdImagens;intI++){
                           Imagem.strImgTif = Imagem.IndicarImagem(Processo.strNmPath,Processo.strSubPath,Processo.intNuImagem,intI);                                                                    
                           out.println("<th>");
                           out.println("<table border=1 STYLE=border-collapse:collapse rules='cols'>");
                           out.println("<tr>");
                           out.println("<th>");
                           %>
                             <img src="ShowImg" WIDTH=100>
                           <%
                           out.println("</th>");
                           out.println("</tr>");
                           out.println("</table>");
    %>and code on the ShowImg servlet:
            response.setContentType("image/jpeg");       
            ServletOutputStream sos = response.getOutputStream();
            RenderedOp src = JAI.create("fileload", Imagem.strImgTif);           
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);       
            encoder.encode(src); 
            sos.close();The problem is if I have 10 images to present, it WILL BE it is executed 10 times and it passes 10 names of different archives, but in the page only the last image is presented 10 times. It is as if it processed the TAG to the end of everything in way that the value of the static variable Imagem.strImgTif was chore only with the last value and the same loaded image 10 times. How I make to solve this? Somebody has some idea?
    THANK YOU !
    Emidio

    If I understand correctly what your problem is:
    Do this in the jsp:
    out.println("<img src=\"ShowImg?image=" + intI + "\" WIDTH=100>");
    In the image servlet, get the "image" parameter and parse it as an int. Move the Imagem.IndicarImagem() call to the image servlet.

  • Web component developer (JSPs and Servlets)

    Which jdk should I download for web component development
    Is it SE or EE?
    Do I need a application server to deploy web applications?
    Please advise.

    user10100078 wrote:
    which application server do you recommend?Well, I'm partial to JBoss, but Glassfish comes included in (at least some of) the installs.
    I don't know anything about application servers.
    please advise in detailThen learn, I don't have the time nor the character limit to explain to you about application servers. But they are documented.

  • How to track the same session using both jsp and servlets

    Hello, guys:
    "how to use jsp and servlet to track the same session",
    it seems to me my logoff.jsp never realize the session I established in my servlets.
    Here is how I set my session in my servlets:
    "     HttpSession session = req.getSession(true);
    session.setAttribute("userid",suserid);"
    Here is how I invalidate my session in my logoff.jsp
    " <%@ page language= "java" %>
    <%@ page import="javax.servlet.http.HttpSession" %>
    <%@ page session="false"%>
    Our Session id is : <%= session.getId() %>
    <% session.removeAttribute("userid");
    session.invalidate();
    %>
    Our Session id is : <%= session.getId() %>"
    but when I try to logoff using the logoff.jsp
    I always get following error message.
    "/home/jiao/jsp_webserver/tomcat/work/Standalone/localhost/syllabus/htmls/logoff_jsp.java:50: cannot resolve symbol
    symbol : variable session
    location: class org.apache.jsp.logoff_jsp
    out.print( session.getId() );"
    T.I.A.
    [Edited by: jiveadmin on Jun 18, 2003 10:32 AM]
    [Edited by: jiveadmin on Jun 18, 2003 10:33 AM]

    So,
    <%@ page session="false"%>
    That means the jsp never instantiates the build in session object.
    <%@ page session="true"%>
    means jsp will instantiates a session object if there are no existing ones
    how about I just delete the line,
    does that mean the jsp will find the existing session object for me?
    So I can do something like
    Our Session id is : <%= session.getId() %>
    <% session.removeAttribute("userid");
    session.invalidate();
    %>
    directly.
    T.I.A.

  • Need Help Badly on Shopping Cart Using JSP And Java Servlet

    Hi All,
    This is the 1st time i am trying to create a shopping cart using JSP and Servlet.
    I have read through a few acticles but i still do not get the whole idea of how it works.
    Please guide me as i need help very badly.
    Thanks.
    This is one of the jsp page which displays the category of products user would like to buy : Products.jsp
    <html>
    <head>
    <title>Purchase Order</title>
    </head>
    <body topmargin="30">
    <table border="0" width="100%" id="table1" cellpadding="2">
         <tr>
              <td bgcolor="#990000" width="96">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
              Code</font></b></td>
              <td bgcolor="#990000" width="260">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
              Description </font></b></td>
              <td bgcolor="#990000" width="130">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Brand
              </font></b></td>
              <td bgcolor="#990000" width="146">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">UOM
              </font></b></td>
              <td bgcolor="#990000" width="57">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Unit<br>
              Price </font></b></td>
              <td bgcolor="#990000" width="62">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
              Carton<br>
              Price </font></b></td>
              <td bgcolor="#990000" width="36">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
              Qty</font></b></td>
              <td bgcolor="#990000" width="65">
              <p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Add<br>
              To Cart</font></b></td>
         </tr>
    <tr>
    <td align="center" width="96" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">123</font>
    </td>
    <td align="center" width="260" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Tom Yam</font>
    </td>
    <td align="center" width="130" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Nissin</font>
    </td>
    <td align="center" width="146" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">12 x 10's</font>
    </td>
    <td align="center" width="57" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">$3.85</font>
    </td>
    <td align="center" width="62" bgcolor="#CCCCCC">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">$46.2</font>
    </td>
    <td align="center" width="36" bgcolor="#CCCCCC">
    <!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="x" -->
    <p align="center"><input type="Integer" name="Q10005" size="1"></p>
    </td>
    <td align="center" width="65" bgcolor="#CCCCCC">
    <p><input type="checkbox" name="checkbox" value="123"></p>
    </tr>
    <tr>
    </table>
    <table border="0" width="100%" id="table2">
         <tr>
              <td>
              <div align="right">          
                   <input type="hidden" name="hAction" value="AddToCart"/> 
              <input type=submit name="submit" value="Add To Cart"/>                     
    </div>
    </td>
         </tr>
    </table>
    </body>
    </html>
    After user has make his selection by entering the qty and ticking on the check box, he would click the "Add To Cart" button ... and this would call my servlet : AddToAddControlSerlvet.java
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    import java.util.*;
    import java.util.ArrayList;
    public class AddToCartControlServlet extends HttpServlet
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
              String action = req.getParameter("hAction");
              if (action.equals("AddToCart"))
                   addToCart(req,res);
         public void addToCart(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              try
                   String url = "";
                   String[] addList = req.getParameterValues("checkbox");
                   HttpSession sess = req.getSession(true);
                   //String sessionID = sess.getId();
                   DBClass dbClass = new DBClass();
                   ArrayList cartList = new ArrayList();
                   for (int i = 0; i < addList.length; i++)
                        String productCode = (String)addList;
                        int qty = Integer.parseInt(req.getParameter("Q"+productCode));
                        Products product = dbClass.getProductDetail(productCode);
                        double totalUnitAmt = qty * product.getUnitPrice();
                        double totalCartonAmt = qty * product.getCartonPrice();
                        Order order = new Order(product.getProductCode(),product.getProductDesc(),product.getBrandName(),product.getUom(),qty,product.getUnitPrice(),product.getCartonPrice(),totalUnitAmt,totalCartonAmt);
                        cartList.add(order);
                   sess.setAttribute("cartList", cartList);
                   url = "/Cart/CartDetails.jsp";
                   ServletContext sc = getServletContext();
                   RequestDispatcher rd = sc.getRequestDispatcher(url);
                   rd.forward(req, res);
              catch (Exception e)
                   System.out.println(e);
    From here, i would get the list of items which user has selected and add to the cartList, then i would direct the user to CartDetails.jsp which displayed the items user has selected.
    From there, user would be able to remove or to continue shopping by selecting other category.
    How i do store all the items user has selected ... everytime he would wan to view his cart ...
    As i would be calling from jsp to servlet .. or jsp to servlet ... and i do not know how i should go about in creating the shopping cart.

    Hi !
    Yon can use a data structure as vector and store the items selected by the user into the vector . Keep the vector in session using session object , so the user can access the entire shopping cart from anywhere in the application .
    Then , you can change the cart accordingly .
    Hope this works.
    Cheers ,
    Pranav

  • Consuming a web service in Oracle9i with JAX-RPC calling

    Hello,
    i need to generate web service client in oracle9i db using jpublisher. And i found in this tutorial http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm that Oracle 9i is not supporting JAX-RPC web services calling, because of JDK 1.3.
    Is there any possibility to consume a web service using JAX-RPC instead of Oracle SOAP in Oracle 9.2 database ?

    I use utl_http pl/sql supplied package for this need - http://akdora.wordpress.com/2007/08/03/calling-a-web-service-by-plsql-utl_http/
    But I believe you may find more information with these resource -
    http://www.oracle.com/technology/sample_code/tech/java/web_services/index.html
    http://forums.oracle.com/forums/forum.jspa?forumID=97
    http://forums.oracle.com/forums/forum.jspa?forumID=99
    http://www.oracle.com/technology/sample_code/tech/java/jsp/dbwebservices.html
    Best regards.

Maybe you are looking for

  • How do I move my documents from word to a PDF ?

    How do I change my existing documents to a PDF ?

  • Center text in JTable

    Hello! Could anyone help me out how center text (or left/right aligment) in JTable cells? Best Regards Staffan

  • Recording audio and adding pics

    I have an iPhone 4 and I would like to record myself singing a song and put it to pics from my phone without hooking up to a computer. How can I do this? Is there an app for that? I've found ones with will do it to songs on my playlist but not a reco

  • In-Design question. How to I install my existing program to my new computer?

    HI, I purchased CS6 for the In-Design in Sept '12 and installed it in Oct '12. I have a new computer and it will not read the files. How do I install it to my new computer. I have my WIN Serial Number if that helps.

  • Split Audio Broadcast Levels

    Hey, guys. I'm cutting my first project for broadcast, and I have a question about split audio levels. My sequence is set to the usual -6dB ceiling, but when I convert from stereo to dual mono and split the music and dialogue tracks, the levels sudde