Syntax for invoking servlet from form in a servlet context

          Hi all,
          I have a web application called A, put all related files in a directory B. I deployed
          some JSPs into a directory C under B. Within a jsp called c.jsp in C, a servlet
          is called in a form. What syntax should I use to call the servlet properly. For
          the given web application A, the url syntax for it is http://server/A/C/c.jsp.
          I used 'action=servlet', 'action=/servlet', but failed. For 'action=servlet',
          the user is directed to http://server/A/C/servlet. The other is http://server/servlet.
          Both are not correct. Any ideas?
          Thanks,
          Lijun
          

What is the servlet-mapping in the web.xml file? If this is your servlet mapping:
          <servlet>
          <servlet-name>CookieCounter</servlet-name>
          <servlet-class>examples.servlets.CookieCounter</servlet-class>
          </servlet>
          <servlet-mapping>
          <servlet-name>CookieCounter</servlet-name>
          <url-pattern>monster</url-pattern>
          </servlet-mapping>
          Then the appropriate action is action=monster (or possibly action=../monster).
          Hope this helps,
          Robert
          Lijun wrote:
          > Hi all,
          >
          > I have a web application called A, put all related files in a directory B. I deployed
          > some JSPs into a directory C under B. Within a jsp called c.jsp in C, a servlet
          > is called in a form. What syntax should I use to call the servlet properly. For
          > the given web application A, the url syntax for it is http://server/A/C/c.jsp.
          > I used 'action=servlet', 'action=/servlet', but failed. For 'action=servlet',
          > the user is directed to http://server/A/C/servlet. The other is http://server/servlet.
          > Both are not correct. Any ideas?
          >
          > Thanks,
          > Lijun
          

Similar Messages

  • Maintain session when calling servlet from form in a JSP

    I have the following set up:
    index.jsp calls login servlet from the action tag in a form.
    Login servlet handles the login, stores the user info and db connection in the session and uses forward(req,res) to call another jsp.
    That jsp has a form where user enters search info and in that form's action tag there is a search servlet. In the search servlet I am unable to access the session.
    Is there any way to pass the session to the servlet from that jsp using a form/action?

    I've read elsewhere that if you go from a jsp to a servlet that the >request object is cleared of any attributes from the previous request.which is correct. But arent we speaking about session object here? A request object is valid for a request - ie the phase from where the server receieves a hit for a resource upto the point it sends the output for that request.
    A session spans multiple requests.
    it doesn't retrieve the session info and gives me a null pointer >exception when I try to use the connection object stored in the session.Bad bad bad . Why do you store Connection objects in session? Create them when necessary or use a connection pool. Do you for example clean up the connections when the session expires. What if its a 30 minute session and the user hits every say 15 minutes with a request. Why do you need to hold on to the Connection in the intervening interval when the user's session is inactive?
    gives me a null pointer exception when I try to use the connection object stored in the session.which means that the Connection object is null - not the session object.
    That last line is where I get the null pointer exception. And that is
    Statement stmt = con.createStatement();?
    Same answer as above.
    If the session object was null,
    userSession.getAttribute("connection");would have thrown a NPE.
    ram.

  • Run servlet from form action tag

    This is my first post to this forum, thanks in advance for any and all help!
    I'm utilizing Tomcat 4.0.1. I've got the following form tag within my JSP:
    <form name="orderForm" method="GET" action="/myAppName/myServletName">
    I've made the context entry for myAppName within ..tomcat/conf/server.xml.
    I've got a properly formatted ..tomcat/webapps/myAppName/web-inf/web.xml
    When submitting the form, Tomcat immediately reports that the resource (myServletName) is unavailable.
    I've download the bookstore sample app from Sun; it is working properly.
    Any idea what I'm missing here?
    The bookstore app calls the servlet from a hyperlink rather that a form action. Do JSP's treat forms differently when calling servlets?
    Thanks again for any assistance.
    Bruce

    Yes, my .class files in in Tomcathome/webapps/appname/web-inf/classes
    If I try and call the servlet from the Address box of the browser, I get the same error listed above.
    Here is the contents of my Tomcathome/webapps/appname/web-inf/web.xml:
    <-- entry begins here
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <servlet>
              <servlet-name>myServletName</servlet-name>
              <servlet-class>myServletName</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>myServletName</servlet-name>
              <url-pattern>/myServletName</url-pattern>
         </servlet-mapping>
    </web-app>
    < -- entry ends here
    Here is the entry I've made in Tomcathome/conf/server.xml:
    <--entry begins here
    <Context path="/appName" docBase="appName" debug="0" reloadable="true" />
    <--entry ends here
    The only Tomcat related entry in my classpath is:
    d:\jakarta-tomcat-4.0.1\common\lib\servlet.jar;
    Again, thanks for all your assistance...this is driving me nuts (granted, it wasn't a long trip!)
    Bruce

  • Procedure for Simple Mail from Forms

    Hi All,
    Is there any procedure to send simple email without
    attachment from forms 9i like we have the feature in oracle reports.
    1.Not using OLE i mean outlook.
    2.Neither calling report.

    First you must:
    ============================================================
    v_mailconn utl_smtp.connection;
    v_hostname VARCHAR2(64);
    v_mailhost VARCHAR2(64):= 'mail.smtphost.com' -- note ***this is not a real mail hostname***
    SELECT host_name INTO v_hostname FROM V$INSTANCE;
    v_mailhost := v_hostname||'.'||v_mailhost;
    v_mailconn := utl_smtp.open_connection(v_mailhost, 25);
    utl_smtp.helo (v_mailconn, v_mailhost);
    -- next call: se below for procedure
    send_mail_to_user(v_mailconn, v_mailhost, p_email, v_subject,
    v_message1, v_message2, p_message);
    utl_smtp.quit (v_mailconn);
    ============================================================
    PROCEDURE send_mail_to_user (p_mailconn IN OUT utl_smtp.connection,
    p_mailhost VARCHAR2, p_email VARCHAR2,
    p_subject VARCHAR2, p_message1 VARCHAR2,
    p_message2 VARCHAR2, p_message3 VARCHAR2) IS
    BEGIN
    -- send mail to a single user, assume the connection has already been opened
    utl_smtp.mail (p_mailconn, p_mailhost);
    utl_smtp.rcpt (p_mailconn, p_email);
    utl_smtp.open_data (p_mailconn);
    utl_smtp.write_data (p_mailconn,
    'To: ' ||'<'||p_email ||'>'|| utl_tcp.crlf ||
    'From: ' ||'My Automated EMail System' || utl_tcp.crlf ||
    'Subject:'|| p_subject || utl_tcp.crlf ||
    'Date:' ||TO_CHAR(NEW_TIME(SYSDATE,'PDT','GMT'),'DD Mon YY HH24:MI:SS')||utl_tcp.crlf);
    utl_smtp.write_data (p_mailconn, utl_tcp.crlf || utl_tcp.crlf ||
    ' -----------------------------------------------' || utl_tcp.crlf ||
    ' | This is an automatically generated email |' || utl_tcp.crlf ||
    ' | |' || utl_tcp.crlf ||
    ' | Do not reply to INFADS Automated EMail System |' || utl_tcp.crlf ||
    ' -----------------------------------------------' || utl_tcp.crlf ||utl_tcp.crlf);
    utl_smtp.write_data (p_mailconn, p_message1 || utl_tcp.crlf || utl_tcp.crlf);
    utl_smtp.write_data (p_mailconn, p_message3 || utl_tcp.crlf || utl_tcp.crlf);
    utl_smtp.write_data (p_mailconn, p_message2 || utl_tcp.crlf);
    utl_smtp.close_data (p_mailconn);
    EXCEPTION
    WHEN OTHERS THEN
    IF SQLCODE = -29279 THEN -- (User Unknown)
    NULL;
    ELSE
    RAISE_APPLICATION_ERROR(-20000, 'send_mail_to_user: '||SQLERRM);
    END IF;
    END;

  • What is the syntax for calling function from class file by jsp

    does anyone here knows what is the syntax of how to call a function from java class file by javascript code or any way to call it?
    and where should i put the calling function code? because the function is called depend on the user click.
    for example
    <%=pc.functionName(a,b)%>
    for the variable a and b, how can i get the value from html textbox and put it in a and b...
    urgent needed...
    thx

    Jsp's are executed before the Html forms are created and loaded. Dont try to use a java code function calling on a javascript click. You'll have to explicitly redirect it into a servlet where in you can call the function you want.
    Well! another way could be using AJAX. That seems to be powerfull enough and it might also serve your purpose.
    Hope this helps

  • Syntax for dynamic dropdown in form

    I have a simple database structure with a table for venues and events.
    I am trying to add a select drop down in my form to add a new event which lists the venues, and inserts the VenueID into a field in the Events table.
    I have this, which I think is pretty close, but its not pulling anything through:
    <select name="VenueID">
        <?php
        $sql = "SELECT VenueID, Venue FROM Venues ORDER BY Venue ASC";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_array($result)) {
        echo '<option value="' . $row['VenueID'] . '">' . $row['Venue'] . '</option>';
        ?>
    </select>
    Thanks for any pointers.

    Just to say I have it working now by explicitly referencing the DB again, i.e. adding:
      mysql_connect('localhost', 'username', 'password');
      mysql_select_db('database');
    A connection file was referenced in the header but must have needed that too.

  • Using the Query Partitioning Technique for calling reports from forms.

    Hello everyone,
    I am having problems using the Query partitioning technique which does not work (??) on the web environment. It seems like you are currently using it. However, I'm not sure whether you have tried this on the web environment. Anyway, see if you can help me please.
    I am populating a record group using data from a form and then pass it as a data parameter to report.
    I use the following codes:
    Add_Parameter(list_id,'Q_1',DATA_PARAMETER,rg_name); /* rg_name is my record group */
    repid := find_report_object('myrep');
    v_rep := RUN_REPORT_OBJECT(repid, list_id); /* list_id is my parameter list */
    In client-server mode, I set the report destination type to preview and it works fine. Data from the record group are displayed in the report.
    To run it on the web environment, I use the following properties:
    Report destination type: cache
    Report server: repserver
    I get no output and the Reports Queue Manager shows the following:
    Description:
    Name: /test/pfs/kn/rep/kn211rp0.rdf
    Owner: dev6
    Destination: Cache Only
    Destination Name:
    Status:
    Current status: [Repserver] Terminated with Error
    REP-0076: Internal failure in product integration.
    Thank you again for a reply
    Kind Regards
    Yogeeraj Degambur
    PS. I am working on the HP-UX environment. Versions: Dev6i patch 5a, Oracle 8.0.5

    hello,
    check the whitepaper "Oracle9iAS Forms Services 6i and Reports Integration" which can be found on otn.oracle.com/products/forms
    regards,
    the oracle reports team

  • How to Get Host Name Domain Name : Port No. for App Server From Forms

    Forms 10g r2
    I am looking to run various forms and reports from within a form. I am using web_show_document. I am passing the URL which includes "http://{host name . domain name : port number}/forms/frmservlet?config=schema1_schema2 form=ab0001 p_param1=151 p_param2=1409 p_x=X". My schema1_schema2 config section in formsweb.cfg contains user name, password, connection information.
    All works well when the actual host_name.domain_name:port_no are hard-coded within a string that is used for the URL with web_show_document, but I need to be able to distribute the form without hard-coding the host_name, domain_name, and port_no.
    I have looked in forms help for application properties, system variables, and within this forum for the built-in or system variable that returns this information, but have not found it.
    Can someone please tell me how I can get this information (host_name, domain_name, and port_number for the application server on which the form is currently running) so that I can build this working URL dynamically?
    I appologize if I have overlooked it within this forum.
    Thanks greatly,
    James

    Thanks, Rosario.
    As it turns out, I don't need the IAS Host_Name, Domain_name, and Port_No. Instead, I can do what I described by stripping off precisely THAT information leaving a URL that looks like:
    v_url := "/forms/frmservlet?config=schema1_schema2 form=ab0001 p_param1=151 p_param2=1409 p_x=X";
    WEB.SHOW_DOCUMENT(v_url,'_blank');
    The original IAS Host_Name, Domain_Name, and Port_No. are assumed and the named config -- schema1_schema2 is still properly referenced so as to use the username/password and connect string to the 2nd schema. This is done by use of the relative path.

  • Syntax for sum in Smart Form based on Selection criteria in Program.

    Hi,
    We have created smart form for printing confirmation entries in desired format. We have given some selection criteria in the program. Now, we want to do the sum of certain fields in the smart form based on selection criteria given in program and selection screen.
    But we are getting wrong sum in the smart form than expected.
    When we debug the program during run time, we are getting correct records as per our expectations. But result of sum in the out put is not as per given selection criteria.
    Do we need to establish link between "select option" and "Smart form"? How can we use internal table created for select option in the smart form?
    Thanks & regards
    Vijay

    Hi,
    There will be no option to sum the values in smartforms, You just have to sum and append the data to internal table and display the internal table data in the form.
    Regards,
    Satish

  • Replacement routine for running reports from Forms 10G?

    Hi,
    I have the following routine that I have been using in Forms 6i to run all of my system reports. I know that Run_Product can no longer be used in 10G and has to be replaced with RUN_REPORT_OBJECT, but can anyone suggest a suitable replacement routine that can be called from my 10G Forms (to avoid getting the FRM-41842 message)?
    Many thanks,
    Keith.
    PROCEDURE RUN_REPORT (IN_RPTNAME IN CHARACTER) IS
    pl_id ParamList;
    BEGIN
    pl_id := Get_Parameter_List('tmpdata');
    IF NOT Id_Null(pl_id) THEN
    Destroy_Parameter_List( pl_id );
    END IF;
    pl_id := Create_Parameter_List('tmpdata');
    Add_Parameter(pl_id, 'MAXIMIZE', TEXT_PARAMETER, 'YES');
    Run_Product(REPORTS, '..\Reports\'||IN_RPTNAME, SYNCHRONOUS, RUNTIME,
    FILESYSTEM, pl_id, NULL);
    END;

    attached link should provide you a clear concept:
    http://www.oracle.com/technology/products/forms/pdf/frm9isrw9i.pdf

  • Syntax for removing fields from auto-suggest index - DisabledAutoSuggestFields

    Hello,
    There are fields I want to remove from the Auto-Suggest Index and I have been told to do this is by adding add an entry in the config.cfg file. For example If I wanted to remove the dOriginalName field from the Auto-Suggest Index I would type the following entry:
    DisabledAutoSuggestFields=table=Documents:fields=dOriginalName
    I understand Documents is the table and dOriginalName is the field. However, what would I type if I wanted to remove more than one field from a different table? For example Documents.dOriginalName and Revisions.dDocName?
    Kind Regards,
    Sandra Terry

    Pipe separate the list.
    DisabledAutoSuggestFields=table=Documents:fields=dOriginalName|table=Revisions:fields=dDocName
    Jonathan
    http://jonathanhult.com

  • Invoke URL from form

    Hi,
    I want to invoke URL, with the help client_OLE2.
    Can somebody give some biref example for this.
    Thanks.

    Why do you want to do it with CLIENT_OLE2? web.show_document does exactly that and you don't have to delve into OLE2 to do it.

  • Syntax for retrieving data from a task container

    Hello Workflow Fans !
    I have a Task with the following configuration:
    BASIC DATA - Object Method :
    Object Category: BOR Object Type
    Object Type: ZBusObj1
    Method: 022_Data_Upd
    CONTAINER :
    I have added a second BOR Object in the container called ZBusObj2
    In conclusion, when the task is executed within my WF run, the method ZBusObj1.022_Data_Upd is executed and both business objects (ZBusObj1 and ZBusObj2) should be available in my Task container.
    My question:
    How, in my method 022_Data_Upd, can I retreive (get) the value of the ZBusObj2 key field (Customer No)?
    Here is what I tried... obviously... without any success:
    BEGIN_METHOD O22_Data_Upd CHANGING CONTAINER.
      break-point.
    * Variable declarations
      DATA: lva_Risk_Cat    TYPE ZTCOMP_PDV-CTLPC.
      DATA: lva_Montant_V TYPE ZTCOMP_PDV-MONTANT_V.
      DATA: lva_Custno       TYPE KNA1-KUNNR.
    * Data retreival from the task container 
      SWC_GET_PROPERTY self 'RiskCategory' lva_Risk_Cat.
      SWC_GET_PROPERTY self 'MONTANT_V'    lva_Montant_V.
      SWC_GET_ELEMENT container 'ZBUSOBJ2.Customerno' lva_Custno.
    The last line (SWC_GET_ELEMENT...) is the one I'm strugling with...
    Any help will be appreciated.
    Thanks in advance.
    José

    So, my understading is that you need an instance of the second object OBJ2 inside the method of the first object OBJ1.
    First, if you only need the customer number, I recommend that you only pass the number itself. Here is what you need to do:
    1- Add an "Import" parameter to method 022_DATA_UPD and call it anything (I'll use PARAM): the parameter can be either an object or a field. You specify the type when you define the parameter. Parameters are added by "single" clicking the method name in SWO1 so that the pointer is on the method name then clicking the "Parameters" button.
    2- Inside the method, add the following code
    Case 1: parameter is an object
    DATA: lvo_custobj  TYPE swc_object.
    DATA: lva_custno TYPE KNA1-KUNNR.
    swc_get_element container 'PARAM' lvo_custobj.
    swc_get_property lvo_custobj '<CUSTOMER_NUMBER_PROPERTY_NAME>' customer_number.
    Case 2: parameter is just a field
    DATA: lva_custno TYPE KNA1-KUNNR.
    swc_get_element container 'PARAM' lva_custno.
    As you can see, adding only the customer number is easier to read. The method should work when you test it in SWO1 before you proceed into the next steps.
    3- Make sure the standard task calling the method is updated with the new parameter. Basically open the task in change mode and type an extra space in the description field then hit Enter. The system will ask you if you want to update the list of parameters.
    4- Update the binding of the task in the workflow template to pass either the customer object or customer number.

  • Calling report from forms :- need to disable file menu in report previewer

    Hi all,
    I am using report 6i and forms 6i
    I am invoking report from forms
    if report_status='N' then I want to disable the file menu in report previewer
    Is it possible to disable and enable file menu in report previewer
    Please help
    Thanks
    :8}

    i got way

  • Migration from Forms 9i to forms 10g (10.1.2)

    I am planning for migration activites from Forms 9i and Reports 9i to Oracle 10g Forms and Reports ( Rel 2 i.e. 10.1.2).
    What are new or removed from 10g forms and repots which was there in Forms 9i ?
    Is there any difference between these two versions ? If No then why there are two diff versions in 10g Forms itself (9.0.4 and 10.1.2)
    Which version of JInitiator I have to use for forms 10g ?

    The versioning scheme is confusing I agree. 9.0.4 and 10.1.2 are the real versions. 10g versions are marketing driven versions.
    10.1.2 is a major revision which means that you have to recompile your forms (if made in earlier versions of Forms) to make them run. 10.1.2 is built on a new version of the required support files (PLSQL for example).
    You can use any supported version of Jinitiator that you like.

Maybe you are looking for

  • [bug-report] AI CC for Mac got "loading plugin error" at startup

    Enviornment: 2012 late Mac Mini, OSX 10.8.6( English ) Just fresh installed adobe illustrator cc for Mac(Simplified Chinese), which is got "loading plugin error" at startup, even update AI or reinstall it after using adobe cc clean tool. Finally I fo

  • Table cells disapear at bottom of page

    Hi, I am trying to set up a page with APs tables and cells and all goes well until I insert information into my center cell and then for some reason the copyright on the bottom of the page dissapears and no matter how much space I give the table abov

  • Can I restore all my pictures on m ipad

    HHow can I restore all my pictures just deleted accidentally

  • Combining classes into one single class

    Hi I have written a java application that incompasses many classes. When I complie my java code the complier produced a ClassName.class file for the main class and each and every class. When I run the application it needs all of the classes not just

  • Nokia X2-00's inbuilt Opera Mini 4.2 won't use cus...

    Hi everyone! I'm from India. I have a Nokia X2-00 (Firmware version 4.90) that I use with an AirTel subscription. I want the phone's inbuilt browser (Opera Mini 4.2) to use the 'Mobile Office' or 'Airtel Internet' access points instead of 'AirTel Liv