Can we Call a Servlet from a OA Page?

Hi All
My requirement is to call a servlet's doPost method from ProcessFormRequest.
I have created one custom OA page. One submit button is there on OA page.When i click submit button it will go to controller's proessFormRequest method and from this method i have to call servlet's doPost method.
Can we do that?
Please Suggest
Best Regards
Majid

Hi Majid,
You can use the following method.
pageContext.setForwardURL("ABC.jsp",
null, // not necessary with KEEP_MENU_CONTEXT
OAWebBeanConstants.KEEP_MENU_CONTEXT, // no change to menu context
null, // No need to specify since we're keeping menu context
hashmap, // params, // request parameters
true, // retain the root application module
OAWebBeanConstants.ADD_BREAD_CRUMB_NO ,// display breadcrumbs
OAWebBeanConstants.IGNORE_MESSAGES );//
Thanks
Anoop

Similar Messages

  • How can i call a servlet from a servlet ?

    Hello,
    Can i call a Servlet from within a Servlet ?
    and is it "right thing" to Do ?
    Thanks

    JMO, but I wouldn't do it like this.
    Don't have a remote object like a servlet doing database queries for your app. That will mean TWO network hops for every query if the database resides on another machine. The network is the biggest bottleneck you've got.
    Write a JavaBean that does the database stuff for you and just have the first servlet instantiate it when it needs it. A Bean has a better chance of being reused, too. Write a TableGateway or DAO for your object.
    Or write an EJB to do it.
    The only time I've done a servlet-to-servlet connection like that was for one servlet running in a DMZ that would authenticate a user and then forward the request to another servlet running inside the second firewall.
    I wouldn't encapsulate database query logic in a servlet like that. JMO - MOD

  • How can i call a zreport from my bsp page.

    Hi friends,
    How can i call a zreport from my bsp page.
    Moosa

    Hi Friend,
    These are the codings  to be wirtten in BSP for transferring values to the REPORT
    DATA:wf_date TYPE ztable-ID.
          data:seltab type standard table of rsparams,
           wa_seltab like line of seltab,
         event TYPE REF TO if_htmlb_data.
    DATA:p_value TYPE REF TO CL_HTMLB_INPUTFIELD.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    p_requ ?= CL_HTMLB_MANAGER=>GET_DATA(
                                            request  = runtime->server->request
                                            name     = 'inputField'
                                            id       = 'i1'
    if p_requ is not initial.
      wf_date = p_requ->value.
    endif.
    clear wa_seltab.
    if wf_date is not initial.
      wa_seltab-selname = 'P_REQU'.
      wa_seltab-kind = 'P'.
      wa_seltab-option = 'EQ'.
      wa_seltab-low = wf_date.
      append wa_seltab to seltab.
    endif.
    submit *ZSAMPLEAP1* with selection-table seltab AND RETURN  .(ZSAMPLEAP1 refers to the report name and AND RETURN for coming back to the BSP page after the completion of its operation in Report )
    IMPORT int_name TO int_name FROM MEMORY ID '*zid*'.(For importing the obtained value from Report)
    In Report
    REPORT  ZSAMPLEAP1.
    SELECT-OPTIONS: p_requ FOR ztable-id  NO INTERVALS.
    SELECT SINGLE name from ztable into int_name WHERE id = p_requ-low.
    WRITE:int_name.
        EXPORT int_name TO MEMORY  ID 'zsharmila'.
    With Regards,
    SHARMILA BRINDHA.M

  • Can we call a responsibility from a OA Page

    Hello All ,
    Can we invoke a responsibility from a OA page , for example like opening a Install Base Responsibility with a button click from a SalesUser page .
    If so can you give the outline of the process .
    A response is highly appreciated.
    Thank you ,
    P.Srikanth .

    Resp. will be tied to a Top Level Menu, which in turn would be launching a Home Page Menu. You can forward to this Home Page Func., to achieve your requirement.

  • Calling a servlet from a JSP page using the J2EE reference implementation

    I have a JSP with an include tag as follows: <jsp:include page="servlet/ConnectionServlet" flush="true" />
    When I use JRUN it works fine. I created an ear file and ported
    the application to the J2EE reference implementation. When running the app under the J2EE reference implementation the ConnectionServlet is never called. I figured it must a deployment issue. I tried adding the ConnectionServlet.class file to the WEB-INF\classes file as servlet\ConnectionServlet.class but the JSP still can't find the servlet. Any ideas where I've gone wrong? TIA, Joe

    I have a JSP with an include tag as follows:
    <jsp:include page="servlet/ConnectionServlet"
    flush="true" />Basically, WEB-INF/classes gets added to the classpath, so the directory structure under this folder should be identical to your package structure. If the ConnectionServlet.class is not actually in a package, then it should be directly in WEB-INF/classes (ie if "servlet" isn't actually the name of your package, don't use a WEB-INF/classes/servlet/" directory).
    Then try taking out the "servlet" from your include tag, so you just have page="/ConnectionServlet" (not sure about the leading slash - try experimenting!)
    if this doesn't work, try adding this to your WEB-INF/web.xml file:
    <web-app><!-- the web-app tags may already be there - don't add more -->
    <servlet>
    <servlet-name>ConnectionServlet</servlet-name>
    <servlet-class>your.full.package.here.ConnectionServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ConnectionServlet</servlet-name>
    <url-pattern>/ConnectionServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    Good Luck!

  • How can I call a servlet from a javascript

    Hello
    I have a JSP page that has 2 aim : save and list. I want to use javascript like this to call my save and list methods :
    <SCRIPT language="JavaScript">
    function savedata(){
    document.kaydetsorgula.action = "hatBilgisiKaydetKontroller.java";
    document.kaydetsorgula.submit();     
    function listdata(){
    document.kaydetsorgula.action = "hatbilGoruntulemeKontroller.java";
    document.kaydetsorgula.submit();     
    </SCRIPT>
    I use this js in my JSP, hatBilgisiKaydetKontroller.java and hatbilGoruntulemeKontroller.java are my servlets names.In servlets I call the methods of sessions.
    Also in my JSP I use
    <tr>
    <td colspan=9 align=center>
    <input type="submit" value="Kaydet" >
    <input type="submit" value="Sorgu">
    </td>
    </tr>
    code to call the js.
    But my code does not work?
    Does anyone have any idea?
    Thanks
    ANIL

    Thanks.....
    I could manage to work it by using <input type="submit" value="Sorgu" onClick="sorgula()"> ...
    And know I have another problem...
    I have a listing page.This pages shows data from a database table and in this table there are 100 rows but I want to show data 10 by 10.I mean when I click on next link I want to see the other 10...
    My JSP code is like this :
    <%@ page contentType="text/html;charset=windows-1254"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.lang.*"%>
    <% Context context = new InitialContext();
    DataSource ds = (DataSource) context.lookup("jdbc/DUKSDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    stmt.executeQuery("select rownum,hatKodu,hatAdi from HATBIL where rownum < 11 order by hatkodu");
    String vhatKodu = request.getParameter("hatKodu");
    ResultSet rs = stmt.getResultSet();
    ResultSetMetaData rsmd = rs.getMetaData();
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
    </head>
    <SCRIPT language="JavaScript">
    function sonrakikayitlar(){
    document.listelemeekrani.action = "listeleme.jsp";
    document.listelemeekrani.submit();     
    </SCRIPT>
    <body>
    <img src="file:/C:/DUKS/ERD Logo.gif" width="100" height="100">
    <H2><center>DEMIR URETIM KONTROL SISTEMI</center> </H2>
    <br>
    <H3><center>HAT BILGISI LISTELEME EKRANI</center> </H3>
    <center><input type="hidden" name="hiddenField">
    <form name="listelemeekrani" method="get">
    <table class="clsScroller" cellspacing="2" cellpadding="3">
    <tr>
    <td>Previous</td>
    <td align="center">
    <select>
    <option selected value="1">1-2 of 2</option>
    </select>
    </td>
    <td>Next</td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td align="center" colspan="5" >HAT KODU</td>
    <td align="center" colspan="5">HAT ADI</td>
    </tr>
    <%
    while (rs.next()) {
    %>
    <tr>
    <td bgcolor="pink" colspan="5"><%=rs.getString("hatKodu")%></td>
    <td bgcolor="pink" colspan="5"><%=rs.getString("hatAdi")%></td>
    <!-- <td bgcolor="pink" colspan="5"><%=vhatKodu%></td>-->
    </tr>
    <%
    rs.close();%>
    </table>
    <% System.out.println(rsmd.getColumnCount()); %></p>
    BILGI GIRIS EKRANI
    </table>
    </form>
    </body>
    </html>
    How?
    Thanks
    ANIL

  • Calling a servlet from another servlet?

    Hi
    I would like to know that how can I call one Servlet from another Servlet. I have tried getServlet() method of ServletContext but it has been deprecated. I want to call a specific method of the other Servlet, is there any other way?
    Thanks

    I should have seen it from your previous post :(
    Code of Servlet 1:
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws
    ServletException, IOException
    RequestDispatcher rDispatch = null ;
    rDispatch = getServletConfig
    ().getServletContext().getRequestDispatcher
    ("/Servlet2") ;
    rDispatch.forward(request, response) ;
    System.out.println("Back in 1");
    I assume Servlets 1and 2 are in same web app and you've mapped your servlet2 to /Servlet2 in your web.xml
    make it as
    rDispatch = request.getRequestDispatcher("/Servlet2");
    rDispatch.forward(request,response);
    Nothin's wrong with yer servlet2

  • How can I call a RFC from dynpage ?

    Hi!
    I would like to know how can I call a RFC from a Portal aplication, dynpage or jspdynpage. there include some libraries ?
    any idea?
    thanks

    for deploying SAP Jra :
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4#search=%22how%20to%20use%20jca%20sapjra%20site%3Asap.com%22
    For lookup of SAP Jra use:
    com.sapportals.connector.connection.IConnectionFactory connectionFactory =(IConnectionFactory) initctx.lookup( "deployedAdapters/SAPFactory/shareable/SAPFactory");
    Using SAP Jra
    http://help.sap.com/saphelp_nw04s/helpdata/en/47/13044258bdd417e10000000a1550b0/content.htm
    The important jars required are:
    connector.jar
    Genericconnector.jar
    prtjndisupport.jar
    Thanks

  • Tomcat 6 – Calling a  Java Servlet from a JSP Page

    Below is a very simple JSP Page that calls a Java Servlet. The question is given Tomcat security constraints, is it possible to call a servlet from a JSP and get the correct output without getting an error message? If so, how would you code the web.xml file?
    c:\apache-tomcat-6.0.18
    Under conf
    catalina
    localhost
    HelloWorldExample.xml is directly under localhost
    The application would have this directory structure:
    webapps
    HelloWorldExample
    hello.jsp is directly under HelloWorldExample
    Under HelloWorldExample
    src
    WEB-INF
    classes
    Under classes
    jservlets
    HelloWorld.java is in src folder
    HelloWorld.class is in jservlets folder
    HelloWorldExample.xml
    <Context path="/HelloWorldExample" docBase="HelloWorldExample" debug="0"
          reloadable="true" crossContext="true">    
    </Context>**************************
    hello.jsp
    <HTML>
    <HEAD>
    <TITLE>Hello</TITLE>
    </HEAD>
    <BODY>
    <FONT SIZE="4">
    <P>
    Please enter your name:
    <FORM 
       METHOD="Post"
       ACTION="servlet/jservlets.HelloWorld">
    <TABLE BORDER="3" CELLPADDING="1" WIDTH="100%" ALIGN="CENTER">
    <TR>
        <TD><B>Name:</B></TD>
        <TD><INPUT TYPE="text" NAME="Name" VALUE="" SIZE="65"> </TD>      
    </TR>
    </TABLE>
    <P>
    <INPUT TYPE="SUBMIT" VALUE="Submit">
    </FORM>
    </FONT>
    </BODY>
    </HTML>******************
    HelloWorld.java
    package jservlets;
    import java.io.*;
    import java.util.Date;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet
       PrintWriter out;
       PrintWriter err; 
       String strName;
    public void displayMessage(HttpServletRequest request, HttpServletResponse response)
          throws Exception
             try
                if (!strName.equals("") && strName != null)
                   out.println("Hello " + strName + "" + "<P>");
                    out.println("Hello World" + "<P>");
                else
                    out.println("Hello World" + "<P>");
            catch (Exception e)
                out.println("Exception: Could not display message." + "<P>");
                err.println (e.getMessage () ) ;
                out.println("<P>");
    public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException
          try
               response.setContentType("text/html"); 
               out = response.getWriter();
               err = response.getWriter();
               strName = request.getParameter("Name").trim();
               out.println("<html><head><title>");        
              out.println("</title></head><body>");
               out.println("<FORM");
               out.println("METHOD=POST");
               out.println("ACTION=http://localhost:8080/HelloWorldExample/hello.jsp>");
             out.println("<TABLE ALIGN='RIGHT'>");
             out.println("<TR>");
             out.println("<TD>");          
               out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Hello World Page\";>");
               out.println("</INPUT>");
              out.println("</TD>");
             out.println("</TR>");
             out.println("</TABLE>");
             out.println("</FORM>");
             out.println("<BR CLEAR='all'>");
               out.println("<P>");        
               displayMessage(request, response);
               out.close();
             out.println("</body></html>");               
           catch(Throwable e)
              e.printStackTrace();
          public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
             doPost(request, response);
    web.xml
    <servlet>
          <servlet-name>HelloWorld</servlet-name>
          <servlet-class>jservlets.HelloWorld</servlet-class>
    </servlet>  
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>      ******************************
    HelloWorld.java can be compiled by using javac.
    Once compiled, HelloWorld.class would be moved to the jservlets folder.
    FYI, coding the above url-pattern results in:
    HTTP Status 404
    The requested resource (/HelloWorldExample/servlet/jservlets.HelloWorld) is not available
    The following url-pattern in the web.xml file permits the servlet to be executed but results in a null pointer exception:
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/ </url-pattern>
    </servlet-mapping>      **************************************************
    Robin

    This problem was resolved.
    In hello.jsp
    ACTION="servlet/jservlets.HelloWorld">
    was replaced with
    ACTION="servlet/HelloWorld">
    Robin

  • Help needed to call a servlet from an applet

    Hi,
    can someone help me with the way to call a servlet from an applet.
    actually on click of a button i wanna call my servlet and save some data in DB.
    i am not able to call my servlet. see the sample code which i am trying..
    public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("Upload")) {
    try {
    System.out.println("Upload button has been clicked -----------");
    URL url = new URL("http://localhost:8084/uploadApp/TestServlet");
    URLConnection urlConnection = url.openConnection();
    urlConnection.setDoInput(true);
    urlConnection.setDoOutput(true);
    urlConnection.setUseCaches(false);
    ObjectOutputStream objOut = new ObjectOutputStream (urlConnection.getOutputStream());
    objOut.writeBytes(userId); // pass parameter to servlet
    objOut.flush();
    objOut.close();
    } catch (MalformedURLException ex) {
    Logger.getLogger(ButtonListener.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
    Logger.getLogger(ButtonListener.class.getName()).log(Level.SEVERE, null, ex);
    is there any problem with the code? please suggest.

    hii,
    checkout my add from, HTH
    [http://forums.sun.com/thread.jspa?threadID=5419921&messageID=10885709#10885709]
    ... kopik

  • Calling a servlet from a servlet?

    Is it possible to call one servlet from another servlet?

    You should use servlets to process requests. If what you're asking for is to execute a piece of logic within a servlet before its finished processing the request, then you should consider using a regular java class instead of a servlet. If you just want to send the request information to another servlet you can use getRequestDipatcher().forward(..) method. Keep in mind that by doing so you'll interupt the current servlet.
    Regards,
    D.

  • Calling a servlet from XSQL

    Has anyone successfully called a servlet from xsql? If you have, have you called one from the href in the xsl:stylesheet?
    null

    Can you post a sample of what you're trying to do? Not sure what you mean by having the XSQL "call a servlet"? Call a servlet when? to serve/use what?
    Are you trying to using a servlet to return a dynamically-constructed stylesheet in the role of:
    <?xml-stylesheet type="text/xsl" href="http://foo/servlets/myservlet"?>
    If not, can you expound on what you're trying to achieve/accomplish?
    Thanks.

  • Call a servlet from Faces Portlet in Websphere

    Hi All,
    I have created a JSR-168 Faces Portlet project and using RAD(IDE) and WebSphere Portal server.
    I want to call a servlet from my jsf portlet.But i do not know where to place my servlet in the project directory.And how to invoke a call to my servlet from my portlet.
    Please help me find an answer.
    Best Regards,
    Pallavi

    hi Pallavi,
    Yes you can do that, what you have to do is you can get the ExternalFacesContext and forward your request to the servlet, you have entry for your servlet in web.xml...
    I am sure about it but you can try this
    Hope it will work.
    Surya

  • Calling a servlet from a Java Stored Procedure

    Hey,
    I'm trying to call a servlet from a Java Stored Procedure and I get an error.
    When I try to call the JSP-class from a main-method, everything works perfectly.
    Java Stored Procedure:
    public static void callServlet() {
    try {
    String servletURL = "http://127.0.0.1:7001/servletname";
    URL url = new URL(servletURL);
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    conn.setDoOutput(true);
    conn.setRequestProperty("Pragma", "no-cache");
    conn.connect();
    ObjectInputStream ois = new ObjectInputStream(conn.getInputStream());
    Integer client = (Integer)ois.readObject();
    ois.close();
    System.out.println(client);
    conn.disconnect();
    } catch (Exception e) {
    e.printStackTrace();
    Servlet:
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    Integer id = new Integer(10);
    OutputStream os = response.getOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(os);
    oos.writeObject(id);
    oos.flush();
    oos.close();
    response.setStatus(0);
    Grant:
    call dbms_java.grant_permission( 'JAVA_USER', 'SYS:java.net.SocketPermission','localhost', 'resolve');
    call dbms_java.grant_permission( 'JAVA_USER','SYS:java.net.SocketPermission', '127.0.0.1:7001', 'connect,resolve');
    Package:
    CREATE OR REPLACE PACKAGE pck_jsp AS
    PROCEDURE callServlet();
    END pck_jsp;
    CREATE OR REPLACE PACKAGE BODY pck_jsp AS
    PROCEDURE callServlet()
    AS LANGUAGE JAVA
    NAME 'JSP.callServlet()';
    END pck_jsp;
    Architecture:
    AS: BEA WebLogic 8.1.2
    DB: Oracle 9i DB 2.0.4
    Exception:
    java.io.StreamCorruptedException: InputStream does not contain a serialized object
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java)
    The Servlet and the class work together perfectly, only when I make the call from
    within the database things go wrong.
    Can anybody help me.
    Thank in advance,
    Bart Laeremans
    ... Desperately seeking knowledge ...

    Look at HttpCallout.java in the following code sample
    http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/jwcache/Readme.html
    Kuassi

  • Calling a Servlet from a JSP within Portal Portlet

    We've created a JSP that calls a Servlet when the form is submitted. The servlet handles the request, does some basic processing and then forwards back to a JSP. This works fine outside of Portal.
    What needs to be done in order for this to work within a portlet in Portal? We can get to the first JSP which is in a portlet, but as soon as we click the submit button (which tries to call the servlet) we get the basic page not found error. We need to click the button, go to the servlet and have the servlet forward back to our portlet.
    I know this is not the ideal way of using Portal however...
    Any ideas?
    Thanks!
    -Teri Kemple
    [email protected]

    I was wondering is there any way I can call a servlet from jsp? There are two scenarios here
    1 - if the jsp is currently being executed/evaluated on the server, then you can use <jsp:include> to "call" a servlet, or <jsp:forward> to cancel the jsp and transfer the control to the servlet.
    2 - if the page is already loaded and running in the client, then the only way to call a servlet is making a HTTP request as from any other html page. Jave code does not execute on the client, so you have to use html/javascript at that point.
    Calling a servlet within another servlet.
    lets say one servlet maintains all dynamic html. I call this servlet from another servlet to create a dynamic page and then insert values into it.Close, but the standard pattern is the reverse of that. What normally happens is you retrieve the values to put in the page, and then call the page, passing in those values. Thats why often you get a servlet/actionbean getting called, which then forwards to a JSP to display the result. The servlet/bean loads all the values required into scope, and then the JSP presents the data.

Maybe you are looking for

  • Photoshop CS2 Upgrade Installation Problems w/ Vista Problems

    I recently purchased a new laptop w/ Windows Vista which I'm trying to install my copy of Photoshop CS2 onto. My Photoshop license is an upgrade license ... originally upgraded from Photoshop v4.0. When installing an upgrade copy of PS CS2, it requir

  • How to add data in IT 184 through portal.

    Hi Experts, I want to add data in IT 184 . I am adding the project description of an employee in this IT type. I will provide the link on portal to add the data in this infotype by it is not possible for me to update the data. Please guide me. Thanks

  • How can you tell between Week 37 and Week 38?

    Hey everyone. Well it took me some research to find out the difference between week 37 and week 38. So to clear up with future readers that arent sure, The "week" refers to when the ipod was made. Anyways, is their a visual difference on the box disp

  • Using Kuler + swatch exchange files in Dreamweaver CS3

    What is the "best practice" for taking a swatch exchange file from Kuler and getting either the swatches into Dreamweaver CS3 or the html color values. I like using Kuler to develop test color schemes for my web sites and switching css sheets to dete

  • Selecting any Playlist Folder lists the entire music library

    I recently switched to a new computer from an old one (both were XP Professional, iTunes version was not completely up-to-date on the older computer) and after migrating the old iTunes library and reconfiguring automatic playlists dependent on others