Executing JavaScript Embeded in a Servlet From another Window

I'm trying to access an object in a Servlet page from another window in a
          frameset. I'm getting an Access denied Error. Can anyone help?
          Very Urgent..
          

Thanks for the reply.
So if I have a method in my DAO class called login() and I want to call it from my control servlet, what would the syntax be ?
getrequestdispatcher.include(newDAO.login())
where newDAO is an instance of the class DAO, would that be correct ?? I'd simply pass the request object as a parameter in the login method and to retrieve the results of login() the requestdispatcher.include method will return whatever I set as an attribute to the request object, do I have that right ?!!!!
Kevin

Similar Messages

  • How to call a servlet from another servlet

    hi everybody,
    i have a problem, i have to call one servlet from another one.
    Everything works on my pc, but when i install the application on the customer's server i got an error about an Uknown URL followed by the name of the machine.
    Wjat i do is the folloqing :
    String urlString = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+servletName;
    URL url = new URL(urlString);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    the variable servletName is the name of the servlet i have to call.
    Is there another way to call the servlet ?
    All the servlet are installed in the same server.
    Any suggestion ?
    Cheers.
    Stefano

    Sweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
    however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
    my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
    It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
    D

  • 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

  • Different ways to invoke a servlet from another servlets?

    Hello,
    I am a bit confused today. I was thinking about all the ways by which I can invoke a servlet from another servlets. I know it can be done by creating an instance of the 2nd servlet in the 1st one. Is there any other way? such as say.... RequestDispatcher perhaps?
    Here is an example to illustrate my point. I have a login.jsp which submits to login.do. login.do search through database and first authenticate email and then the corresponding password. Now its time for displayGame.do. So here how do i do? if it was a displayGame.jsp then i could have used Redirection or Forward but when it is servlets? Can I still go for Redirection or Forward??
    Thank you for reading this confused post. :-)

    if it was a displayGame.jsp then i could have used Redirection or Forward but when it is servlets?Question: do you know what a JSP becomes when you first run it?
    Answer: a servlet.
    So yes, you can use a RequestDispatcher to forward/redirect to a servlet OR a JSP, whatever you like.

  • How to handle "/9.2.0/root.sh as root from another window" in silent instal

    Hi,
    I was successful to start a silent installation of Oracle9iR2 using a responsefile on my System RHEL 3. But the installation ends soon and a wrong successful install message:
    Error :*** Alert: A configuration script needs to be run as root before installation can proceed. Please leave this window up, go run /opt/app/oracle/product/9.2.0/root.sh as root from another window, then come back here and click OK to continue. ***
    The installation of Oracle9i Database was successful.
    I use -ignorePatchConflicts for ignoring the patch conflicts. But How do I handle these issues. Where I have to run root.sh ... etc in teh Non Interactive Install.
    I am scripting solution for non interactive install and manual intervention to run these root.sh shell scripts at different points of install is not a good idea as it wont help me automate the install.
    Please let me know if anyone has solved this problem with -silent install.
    Thanks in advance.
    Senthil

    Thats me (OP) again:
    I tried setting:
    SHOW_ROOTSH_CONFIRMATION=false in the response file. But still no help. The installation exits at run root.sh prompt point. How I can effectively deal with it in a script?

  • Oracle Database XE - apex on Windows 7 - Problem with Connection from another Windows 7 Computer

    Hello,
    I started with Oracle Database XE 11g, with apex, did the upgrade to Apex 4.2.6 and started in developing a small Application.
    I wanted to Connect to my Computer A (with Database runing on it) from another Windows 7 Computer B.
    So I put in in Firefox: //A:8080/apex but I only received a timeout.
    Of course on both Computers there is a windows-Firewall running, so I stopped on both Systems the Firewall, but its the same still.
    In the windows explorer running on Computer B , I can see the data of Computer A and both Computers are in the same home-net-group. (sorry for my poor english).
    Is there anyone who cann tell me how to get the Connection running ?
    Maybe I didn't see the info about this in the manuals, if it is there, please give me a hint.
    many thanks
    Wilhelm Kästner Salzburg

    Hi,
    Check if this helps
    https://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#XEINW127
    Regards,
    Jari

  • What is the best way to call a servlet from another servlet?

    I have a project with 9 servlets (class project). The way I have been moving from servlet to servlet is like this
    doPost(...)
    {      response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>Functions</title>");
    out.println(f"<form name=frm6 method=post action=/servlet2");
    out.println("<input type=submit name='btn' value='servlet2'>");
    out.println("</form>");
    So I have these 9 servlets - I call any 8 of them from the first servlet so I have 8 buttons on 8 forms <form=frm1, frm2, ...frm8 method = post...> But when I bring up the first servlet only 6 buttons show up. I was thinking about using hyperlinks instead, but I would like to do this with buttons. I wanted to do this with javascript and the location object, but I was advised to use jsp. I just want to move from one servlet to the next. Any suggestions appreciated for the best/preferred method for moving from one servlet to the next.
    Thanks

    I think you may need some clarification of terminology etc..
    First off, JSP isn't an alternative to javascript, it's an alternative to coding a servlet. A JSP is a mixture of java code and HTML and is translated into a servlet by the system. JSPs are primarilly for generating HTML pages with variable content. JSPs very frequently generate HTML which includes Javascript.
    You probably shouldn't think of what you're doing as one servlet invoking another, that does happen; a servlet can transfer an transaction to another servlet or JSP. In fact it's standard practice that a servlet does the logical stuff (like interpretting form data) then transfers to a JSP to generate the response page. However in this case it's the browser that can invoke one of the 8 servlets, the first servlet merely creates the page from which they are invoked.
    It's not obvious why only some of your buttons are showing up. In a case like this use the "view source" option on your browser to find out what HTML the servlet is actually delivering. What's wrong should be evident from that.
    You can put a hyperlink arround a button, or an image. Mostly people turn up their noses at the buttons supplied by HTML and use their own images for buttons. You
    can do somthing like this:
    <img src="/images/button3.png" border="0">
    (Of course this arrives as a GET transaction not a POST).
    Or you can do a bit of javascript like:
    <img src="/images/button3.png" style="Cursor: pointer;"
    onclick="document.locations.href='/servlet3';">

  • Calling servlet from another method

    Hi,
    I am writing a program which requires executing another servlet from within
    thie main program. I do not care to return the information from the servlet
    request.
    http://usx500.crn.st.com:7000/TPMCenter_V2/insertAutomationValue.do?reqCode=confirmed
    Thanks for the help.

    The reason I continue posting this question, is because I cannot find a solution.
    I have looked through the link provided, as well as many other solutions on the web,
    none which have been successful. Following are two solutions which I have tried, and
    niether have worked. I still am in need of some help in resolving this. If you would like
    to assist me in this it would be greatly appreciated.
    Dr Clap--
    If you do not have a suggested solution, simply do not reply.
    Solution 1 ---
        try {
            // Construct data
            String data = URLEncoder.encode( "reqCode", "UTF-8") + "=" + URLEncoder.encode( "show", "UTF-8" ) ;
            // Create a socket to the host
            String hostname = "usx500.crn.st.com" ;
            int port = 7000 ;
            InetAddress addr = InetAddress.getByName( hostname );
            Socket socket = new Socket( addr, port );
            // Send header
            String path = "/TPMCenter_V2/insertAutomationValue.do";
            BufferedWriter wr = new BufferedWriter( new OutputStreamWriter( socket.getOutputStream(), "UTF8" ) ) ;
            wr.write( "POST " + path + " HTTP/1.0\r\n" );
            wr.write( "Content-Length: " + data.length() + "\r\n" ) ;
            wr.write( "Content-Type: application/x-www-form-urlencoded\r\n" ) ;
            wr.write("\r\n");
            // Send data
            wr.write(data);
            wr.flush();
            wr.close();
        } catch (Exception e) {
            e.printStackTrace() ;
        }Solution 2 ---
    try{
        URLConnection c = new URL("http://usx500.crn.st.com:7000/TPMCenter_V2/insertAutomationValue.do?reqCode=show").openConnection();
        c.connect();
    }catch(MalformedURLException murle){
        System.out.println(murle);
    }catch(IOException ioe){
        System.out.println(ioe);
    }

  • How to call a specific method in a servlet from another servlet

    Hi peeps, this post is kinda linked to my other thread but more direct !!
    I need to call a method from another servlet and retrieve info/objects from that method and manipulate them in the originating servlet .... how can I do it ?
    Assume the originating servlet is called Control and the servlet/method I want to access is DAO/login.
    I can create an object of the DAO class, say newDAO, and access the login method by newDAO.login(username, password). Then how do I get the returned info from the DAO ??
    Can I use the RequestDispatcher to INCLUDE the call to the DAO class method "login" ???
    Cheers
    Kevin

    Thanks for the reply.
    So if I have a method in my DAO class called login() and I want to call it from my control servlet, what would the syntax be ?
    getrequestdispatcher.include(newDAO.login())
    where newDAO is an instance of the class DAO, would that be correct ?? I'd simply pass the request object as a parameter in the login method and to retrieve the results of login() the requestdispatcher.include method will return whatever I set as an attribute to the request object, do I have that right ?!!!!
    Kevin

  • Problem in invoking a servlet from another PC

    hi
    i am trying to invoke a servlet running on apache tomcat 5.0.28 from another PC, my j2me wireless toolkit is on one PC and it runs a MIDlet that invokes a servlet on another PC, but am getting an exception connectionNotFound....
    both the computers are on LAN, what do i do?
    Need guidance

    No, i think tomcat server is enough.. have u checked your servlet from browser?
    I got the same error in black berry application and at that time i found that its due to servlet config in web.xml
    Have u configured your servlet in web.xml?
    One suggestion.. change your URL to www.google.com and then run your MIDlet.. it confermed that your midlet is OK
    Http request is fine to send data from your WTK.
    About apache http "NO IDEA"
    Thks

  • Taking screenshot from another window

    I am writing an application in which I have to take a screenshot from another application's window. Is this possible in Java?

    hi friend,
    We can capture the Entire screen using java's Robot class.
    Dimension screenDim =  Toolkit.getDefaultToolkit().getScreenSize();
                Robot r=new Robot();
                BufferedImage bi=r.createScreenCapture(new Rectangle(0,0,(int)screenDim.getWidth(), (int)screenDim.getHeight()));
                File f=new File("screen.png");
                 ImageIO.write(bi, "png",f);

  • Photos from another windows account have appeared on iPod

    I've recently found my images from my windows account have appeared on my mothers ipod despite it being synced to another windows account where the images are not even accessable due to the permissions.
    To ensure that my problem is clear, my images are stored on my account named "John" on my windows desktop PC. My mothers ipod is synced to the account "Mum", where the images are not even accessible from due to it being a limited account.
    The images cannot be deleted on the ipod, and have appeared around two days ago, despite the ipod not being connected to the computer. I can only add the images to another album, or share them.
    In itunes, the checkbox on the photos tab for it to sync it deselected, and so it's not even like they should be syncing any photos at all.

    Even if we don't work out how it has happened, how can I just remove the images? It's vital I remove them as soon as possible as some of the photos were sent to me from my girlfriend and really aren't to be viewed by my 55 year old mother.

  • After Installing Acrobat X Standard, Cannot print from another Windows Program

    I am having a strange problem.  Once I installed Acrobat X Standard, another Windows based program stopped printing.  It now comes up with a usp10.dll error, but most of the time it just crashes the program.  Tried reinstalling the program and no luck.  The error points at a Helvetica Font being the culprit that was installed with Acrobat.  I am not sure how to clear this up.
    Thanks

    I have not removed it.  One of the things I did try was going into the Registry and to FontSubstitutions and change the Helv to Helv,186 or something like that.

  • Executing a report program in background from another program

    Hi Experts,
    I developed a report to display material change history based on change date range. Report is taking much time (around 15-20 mins) as I'm hitting CDPOS and CDHDR tables. User wants to execute the report in foreground because he/she can give selection criteria that is required everytime.
    So, my requirment is now to create another program with same selection screen elements which will execute the original program in background. In the new program, we will be just capturing the selection elements and will pass them to original program to run in background and display a message to user without wait for the background job to complete. Original program should send an email to an fixed email id with the report output as attachment (for example excel file).
    Please suggest.
    Thanks in Advance,
    Siva Sankar

    Hi Siva,
    Please see the link
    http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm
    Regarding a Change Document Function Module ----- VERY VERY Urgent
    When using function modules , I dont think you can directly get data based on material and plant . these function modules usualy works with object class and creation date .
    Once you retrieve the data using the function modules you have to filter out the unncecessary data based on your selection screen conditions .
    Regards,
    Ratheesh BS
    Edited by: Ratheesh Bhaskarapillai Suseeladev on Mar 8, 2012 5:19 AM
    Regarding a Change Document Function Module ----- VERY VERY Urgent

  • Calling One Servlet From Another

    Thanks in advance for any advice!
    I would like to call servletB from servletA then use the response returned from servletB within the processing of servletA.
    I have checked the forums and jGuru but nothing I've found really matches the problem. RequestDispatcher has "forward" and "include" but I do not want to include the reponse from the called servlet in the response of the original one.
    Here is the situation. I have a web application that uses an applet front-end using a mainframe datasource. The applet displays data in various JTables and prints various reports.
    The applet calls a servlet(B) with an SQL statement in the request that responds with a Vector of data to be displayed in the JTable. This is working fine.
    The applet also calls servlet(A) which uses iText from SourceForge to create a PDF report that is sent back to the browser for display in Adobe Reader. This also works fine.
    Because I cannot figure out how to call servletB from within servletA, my current workaround is to embed the code of servletB inside servletA. Not very good OOP and as the application grows maintaining this will become a problem.
    Any suggestions would be greatly appreciated.
    Max

    Why don't you just take the code that the applet uses to "call" servlet B and replicate that code into servlet "A"? (Or better still, create a class to do that, which could be called both from the applet and from servlet A.)

Maybe you are looking for

  • How to use JNDI lookup from a JSP

    Hello, I know I should not be doing this (writing the lookup code in a JSP) but have to do it for some reasons. I am using this code in my JSP: try      Context ctx = new InitialContext();      dataSource = (DataSource)ctx.lookup("jdbc/mybillingora")

  • How to Create a simple report with headers and repetitive details

    Hi All, I have been trying to do a report through PLD with a query that accept a parameter and has been saved into a Query category of the Query Manager. The Problem that i have encountered is that though i wish to have some of my fields into the Rep

  • Critical Acrobat 9.1 Security Fix & Upgrade

    There have been stories in the past few weeks about a critical JavaScript Buffer Overrun Attack in Acrobat and Adobe Reader. Adobe has now posted a critical security patch for current versions of Acrobat 9 and Adobe Reader 9. http://www.adobe.com/sup

  • Java5: Can't find a way to get rid of warnings about generic types

    Hi all, i have this method:     public static void insert(List list, int index, Object obj) {         list.add(obj);         int j = list.size() - 1;         for (; j > index; j--) {             list.set(j - 1, list.get(j));         list.set(index, o

  • Where the AAA cache is stored??

                       Hi, I'd like to know where the DB for the AAA caching is stored. because i made a caching for my users and it works well. but at reboot, the cache is empty and we need to reauthenticate to populate the DB. Is it possible to store t