Servlet with CGI

hello,
We have an applet that execute a cgi program and now we want to replace that applet with a servlet executing the same cgi.
Does anyone know how i can execute my CGI bin with a servlet or javabean?
Thanks and good luck
minhqt

hi,
Maybe i didn't explain myself clearly, i would like to know how i can use java urlconnection class to connect my java servlet to cgi. What i'm trying to do is create a jsp page that include a servlet and this servlet pass selected parameters from my jsp page to my existing cgi code.
so the question here is 1)how do i send these parameters to my cgi and 2) how can i receive cgi output to later on display using jsp.
While doing these what are some errors handling code do i need to know.
Thanks
minhqt

Similar Messages

  • How can i deploy a servlet with eclispe

    Hello,
    will any one of u give me the steps to deploy a servlet with eclipse on portal server(J2EE Engine),
    in help of eclipse they given as, whole webapplication deployement, but that is also giving me a error, the procedure they given is, once we created a .war file for our servlet project we need to refer this to a .Ear file, and then this Ear can be deployed in to the server. Is it the same and only procedure to deploy a servlet with eclipse, or if there is any other method,please give me the steps also.
    when i am deploying with the .Ear file, it is giving the error as,
    Jun 4, 2005 11:34:31 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Deployment exception : Cannot determine sdm host (is empty). Please configure your engine/sdm correctly !
    but the sdm is working on the server with the same host, and local deployement is also done successfully, but from my system im not able to deploy!
    Thanks&Regards,
    Sireesha.

    Yeah, i am able to see the J2EE engine clusters, there the message server port is given as 3601. becoz scs instance number is 1 here. so it is not the problem,
    the error it is giving as,
    Jun 6, 2005 11:37:28 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : obtdev9
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME1/sireesha.b/LOCALS1/Temp/temp56446MyServletEAR.ear
    Deployment exception : Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    Inner exception was :
    Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    is this may be the problem with port number?
    i am not knowing what is happening here...
    if you know the exact error based on the error messgae please help me,
    thanks to u for helping in this problem,
    Regards,
    sireesha.

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • How to pass parameters to servlet with POST with  Business Service OSB

    Hi all.
    I am newby in OSB. I am trying to send some values through a POST call to a servlet. I know how to call the servlet with Business Service of type "Messaging Service". I send the parameters of type Text.
    I have tried several ways, but I don`t find the proper way yo do it. I have tried to insert the param into the body and into the header.
    The problem is that I don`t know exactly where to put them, I don`t know if it must be done in the header or in the boy. I neither don`t know if there is a common way to do this.
    Please, could you give me a good example of an insert activity to isert a post parameter inside the call?
    For example: now I am using this one:
    Expression => "accountType=test"
    Location => as first child of"
    XPATH => empty.
    In variable => body.
    Where do I have to insert this, in the body or in the outbounds?
    I have followed this posts:
    https://blogs.oracle.com/jeffdavies/entry/enhanced_rest_support_in_oracl
    http://www.yenlo.nl/en/using-osb-with-rest/
    Thanks a lot.

    Hi,
    Please be carefull about passing values such as Strings or number that contains ',' .
    using the way described above.
    the best way is to pass an ID and then use a select Statement to get the other Values in the target page.
    regards
    MDK.

  • Messed up response to calls to same servlet with different parameters

    Hi,
    I am facing a very strange problem on our production server which is a tomcat 3.2.3 and mod-jk . We have a servlet that recieves a couple of parameters and returns the page contents based on those parameters. Now, if two users call the servlet with their own (different) parameters, sometime the result for one user goes to another one and vice versa.
    For example, if user 1 calls :
    http://www.mydomain.com/servlet/DynamicPageBuild?siteID=577&categoryID=69&catName=
    and user 2 calls (note the difference in parameters) :
    http://www.mydomain.com/servlet/DynamicPageBuild?siteID=781&categoryID=54&catName=
    SOMETIMES the result of first request ends up going to user 2's browser or vice versa!
    Anyone PLEASE any ideas of why this is happening?

    When this happens there are two threads in the servlet container, and both of them are (simultaneously) running the same instance of the servlet. So if your servlet has instance variables, both threads (the two users) are accessing and changing the same instance variables... remember, there's only one instance of the servlet.
    So if you change your servlet logic to use local variables (the ones declared inside a method) instead of instance variables, that would probably solve your problem (although it could be more complicated than that). Each thread would have its own copy of the local variables, and there would be no conflict.

  • Servlet with Database Access!!!

    Hi !!!!
    I have deployed HelloServlet with Oracle Application Server 4.0.8.1.
    Now I want to connect from Servlet to Oracle8i 8.1.5.
    But, when I try to deploy a Servlet with Database Access, I receive the next:
    "Get operation not allowed"
    The URL used is:
    http://host.domain:port/virtual_path/class_name
    The servlet was compiled using the Sun's jdk from command line. There wasn't compilation errors.
    I run a simple application with database access from command line without problems.
    The drivers and JDBC libraries are operating for this simple application.
    Any help will be appreciated.
    Many thanks
    Sergio

    If you are running OAS 4.0.8.1 and Oracle 8.1.5 on the same machine then this could be the problem. These products are not certified to run on the same machine as they give a path conflict.
    Hope this helps.

  • How to activate / disactivate a servlet with a java client ?

    I would like to know how to activate or disactivate a servlet with a java client or an applet ?
    Thanks...

    What does "activate" mean for servlets?

  • Servlet with 2 Response Streams

    I want to create a Servlet with 2 response streams. I need to use 1 response Stream to send Continuous Updates received on the server
    and the other response Stream would be used to send Heartbeats to the Client. I tried to create the Servlet but the response I create to send the continuous data just stops sending data to the Client after many attempts. In this attached Servlet, The response for continuous data stopped after 150 refreshes.
    Please let me know how to fix the issue. I tried reset() too but does not seem to work. Will very much appreciate any help.
    package com.XX;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class TestServlet extends HttpServlet{
         private static final long serialVersionUID = 1L;
         public static int count = 0;
         private TestSave testSave = null;
         private HttpServletResponse resp = null;
         public void init(){
              testSave = new TestSave();
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
              count ++;
              if(testSave == null){
                   System.out.println(" test save = null");
                   return;
              if(testSave.getRes()==null){
              System.out.println(" test save resp is null");          
              testSave.setRes(res);
              res.getWriter().println(" Initial Daily count Response ");
              }else{
              res.getWriter().println(" Daily response " + count);
              //res.getWriter().close();
         System.out.println(" test save resp is not null");
              resp = testSave.getRes();
              String data = "Count is "+count;
              System.out.println(" Writing response " + resp);
              System.out.println(" Writing Data " + data);
              System.out.println(" Response committed 1 - " + count + " : " + resp.isCommitted());
              resp.getWriter().println(data);
              System.out.println(" Response committed 2 - " + count + " : " + resp.isCommitted());
              System.out.println(" Daily Response committed ??? " + res.isCommitted());
         protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
              doGet(req,res);          
    }

    The TestSave code.
    import javax.servlet.http.HttpServletResponse;
    public class TestSave {
         HttpServletResponse res;
         public HttpServletResponse getRes() {
              return res;
         public void setRes(HttpServletResponse res) {
              this.res = res;
    }

  • Servlet with HTML using JDBC lookup

              Dear Friends
              How are you?
              I am designing a servlet with two drop down lists one on top and the other below.
              I implemented drop down lists using dynamic embedded HTML and SELECT tags.
              I want the user to make a selection in the first drop down list, and the second
              drop down list should display a list based on the selection made in the first
              drop down list.
              Please comment in detail on the most efficient way of achieving this.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              

    For this I'd probably load all the values for both drop down list and use
              javascript.
              Tinou Bao
              www.tinou.com
              "Sriram (Ram) Peddibhotla" <[email protected]> wrote in message
              news:3b181cd0$[email protected]..
              >
              > Dear Friends
              >
              > How are you?
              >
              > I am designing a servlet with two drop down lists one on top and the other
              below.
              > I implemented drop down lists using dynamic embedded HTML and SELECT tags.
              >
              > I want the user to make a selection in the first drop down list, and the
              second
              > drop down list should display a list based on the selection made in the
              first
              > drop down list.
              >
              > Please comment in detail on the most efficient way of achieving this.
              >
              > Thanking you
              > Very truly yours
              > Sriram (Ram) Peddibhotla, PhD
              

  • Can I compiler servlet with java compiler?

    Can I compiler servlet with java compiler?
    Here is an example of it:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HelloWorldServlet extends HttpServlet
              protected void doGet(HttpServletRequest request,
              HttpServletResponse response) throws ServletException , IOException
                        response.setContentType("text/html");
                        PrintWriter out = response.getWriter();
                        StringBuffer sb = new StringBuffer();
                        sb.append("<html><body><h1>");
                        sb.append("Hello World");
                        sb.append("</h1></body></html>");
                        out.print(sb.toString());
                        out.close();
         }

    Can I compiler servlet with java compiler?
    yes.
    just include the correct jarfiles in your classpath.

  • How to run servlet with tomcat

    I have a probrom that how can I run servlet with tomcat?
    I have new a folder classes in webapps\root\WEB-INF\,and put the .class
    programme in it ,but http://localhost:8080/servlet/HelloWorldExample
    can't run ,it give me a error than http:404 not found.
    could you tell me how i can solve the problem.
    Thank u very much.

    Hi,
    Make sure the class is in classpath or in WEB-INF/classes folder and make an entry for servlet tag in web.xml in WEB-INF folder.
    Regards

  • Calling servlet with out entry in web.xml

    Hi
    I want to know whether can a servlet be invoked with out having an entry in web.xml.Because to my knowledge when ever an entry is made in teh web.xml the <url-pattern> and the class file will be stored as key value combination it is only then when ever a request is made the server gets the class taht is to be invoked from the <url-pattern> that is passed from the client side.
    Is ther any way by whihc we can call the servlet directly with out an entry in web.xml
    Thanks in advance
    Ajithkumar.S

    Interesting that it is possible on Tomcat anyway.
    What's the real benefit of not having a Servlet
    definied in web.xml?
    The only benefit I see is that
    you don't need to understand/read/change XML when
    adding or removing a servlet. That isn't worth that
    imho. What are the other benefits?The only thing I can think of is , to be able to quickly access a Servlet that you've just written, because it takes additional steps to define it in the web.xml.
    I think it would be a security concern (of some sort) , if the Servlet's class is known, that's why it is better to access a Servlet with a mapping from web.xml

  • Does WLS support Debugging Servlets with JBuilder 3 ?

    I have read all the news groups and it appears that WLS 4.5.1 does not
    support debugging Servlets with Jbuilder 3.0.
    I am using the trial version, does this matter ?
    Or should I just buy another web server ?
    Joe

    I think below documents will be helpful to you.
    http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13952/taskhelp/webservices/webservicesecurity/CreateDefaultWSSConfig.html
    This document tell you that you can attach a weblogic webservice configuration using weblogic admin console.
    After creating this configuration you need to updated this configuration as per the steps given under :
    Use X.509 certificates to establish identity
    Thanks,
    sandeep

  • Invoke servlet with javascript

    Hello.
    I need to invoke a servlet with javascript when the user clicks a button.
    Is there a way to invoke the servlet without submitting the page ?
    Thanks in advance.

    onchange="location.replace('ServletName');"

  • Pls give me example of Java Servlet with Oracle

    Hi Guys,
    I am new to Database connectivity of JAVA Servlet with Oracle.
    So can you give me one complete example of connecting Java Servlet with Oracle 9i database.
    [ i mean Select statement, Insert statement..]
    I have tomcat server which comes built-in with NetBeans IDE.
    I need this because, i always come accross messages saying that " you need to change classpath this way " , or " you need to write connection this way "....
    So to avoid all this wrong things..i need your help.
    You guys can reply me on [email protected]
    Thanks & Appreciate..
    Dal Hit

    I got succeeded!
    I changed the three point:
    * add 'package hoo;' in HelloBean.java
    * add '<%@ page import="my.HelloBean" %>' in hello3.jsp
    * change '<jsp:useBean id="hello" class="HelloBean">
    to '<jsp:useBean id="hello" class="my.HelloBean">
    Before posting, I searched google three times but couldn't get answer.
    I could not get well if you didn't give me help...
    Thank you very much.

Maybe you are looking for

  • Hot Synch failure iQue 3600 - Windows XP

    I have an iQue 3600 that I am no longer using but want to synch my data.  HotSynch cannot connect with computer.  When I look for HotSynch icon in system tray, it is a black box.  What do I need to do to synchronize my data?  Do I need to reinstall m

  • 2 Conky Problems-Suddenly scrunched formatting and IP set to 127.0.0.1

    I have 2 problems with conky, I'm not sure if they are related. First, conky started displaying all scrunched up with much of the formatting wrong. I did not make any configuration changes at the time. I'm sure that I can go through my conkyrc and ad

  • I'd like to set my gutters in em or px, rather than %.

    Hi, I know this is likely to be a big ask, but is it going to be possible to set gutters in em or px at some stage? In my opinion, gutter width should be relative to type size. My type size increases a little as the page (screen) size increases - due

  • Connect with order by clause

    I have a query to get all child records from table lm and in the order they stored in a table s do you see in problem with the below query select distinct s.id from s, (select p.id from p start with p.child_id= 10 connect by prior p.id = p.child_id)

  • The best way to use 2 iPhones on one mac

    What is the best way to use, sync, etc, 2 iphones with one mac book pro? Looking to optimize!