Java servlet

I don t really know if this is the right place to post this message
I have been developing java application and applet for a while and know i would like to start servlet but i am a little lost
i am using eclipse 3.2 on mac os and i dont really where to start
i download java_ee_sdk-5_02-mac.zip but i have no clue of how to install it
what to i have to do to start writting servlet code in eclipse
thanks

i download a bunch of stuff as wtp but eclipse still doesn t recognize some class as session and transport. I am trying to send a mail via my application. I have tomcat running on a server and i am trying to write the code. I was able to grab some code from internet but eclipse wont recognize those classes. I am using eclipse 3.3 and i did download wtp plug in and successfully install. I am running all this on a macos x
I download netbeans and all those classes are recognized fine but since i have never used netbeans before i fail in compiling my project. Anyway i would like to stick with eclipse for now and make this work. I did download javamail.jar but eclipse still do not recognize those classes.
What should i do to get this rolling
thanks in advance

Similar Messages

  • Help: No Parameters, HTML Output from Java Servlet

    I have a Java Servlet that reads parameters passed from an HTML form and displays them to another HTML page. I know the servlet is being invoked; however, I am not seeing any HTML output. Sending the output to a file reveals the parameters are coming in as NULL as well.
    I attempted a simple sample app with the same results. Here is what I am running:
    The HTML Form:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Collecting Three Parameters</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FDF5E6">
    <H1 ALIGN="CENTER">Collecting Three Parameters</H1>
    <FORM ACTION="ThreeParams">
    First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
    Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
    Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
    <CENTER><INPUT TYPE="SUBMIT"></CENTER>
    </FORM>
    </BODY>
    </HTML>
    The Java Code:
    public class ThreeParams extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Reading Three Request Parameters";
    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
         "Transitional//EN\">\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
    "<UL>\n" +
    " <LI><B>param1</B>: "
    + request.getParameter("param1") + "\n" +
    " <LI><B>param2</B>: "
    + request.getParameter("param2") + "\n" +
    " <LI><B>param3</B>: "
    + request.getParameter("param3") + "\n" +
    "</UL>\n" +
    "</BODY></HTML>");
    What happens when I "submit" from the form is the same form reloads with the query string in the URL: "http://localhost:8080/ThreeParams/?param1=1&param2=2&param3=3"
    Any assistance with either (or both) would be thoroughly appreciated:
    a) why the parameters are not being passed correctly to the servlet
    b) why the HTML output page is not displayed
    Thanks in advance!
    - Steve

    I have found the answer to my problem listed in another thread.
    Thank you.

  • Problem with JSP and Java Servlet Web Application....

    Hi every body....
    I av developed a web based application with java (jsp and Java Servlets)....
    that was working fine on Lane and Local Host....
    But when i upload on internet with unix package my servlets and Java Beans are not working .....
    also not access database which i developed on My Sql....
    M using cpanel support on web server
    Plz gave me solution...
    Thanx looking forward Adnan

    You need to elaborate "not working" in developer's perspective instead of in user's perspective.

  • Java servlets

    I am using Java Servlet and SQL.. i want to open two tables with two resultset objects...
    i closed the first resultset and statement object. now open the second resultset and statement..
    here the objects are created but the while doling "while(rs.next())" is not executed...
    please solve this problem ...
    another one is i am using the requestdispatcher
    in the first servlet i havae the dopost method in this i put the requestdispatcher with forward or include from one servlet to another servlet .. here gives the expection is
    do not match with post url
    why this is happened....

    ramkrishna.goli wrote:
    I am using Java Servlet and SQL.. make sure you aren't putting database calling directly in your Servlet
    create a DAO layer to decouple the business logic from the data access methods
    i want to open two tables with two resultset objects...i think you mean you want to perform 2 queries and get back 2 ResultSets
    i closed the first resultset and statement object. now open the second resultset and statement..
    here the objects are created but the while doling "while(rs.next())" is not executed...was an error thrown?
    if not, just sounds to me like no database records were found/returned
    i.e. empty ResultSet
    please solve this problem ...that's your job!

  • Long running reports using java servlets

    Hello,
    I'm running into a problem using java servlets to produce database reports and sending them back to the client browser as excel or html. The problem comes into play when the user has submitted two reports then goes to run a third and the browser hangs. I realized now that this is because of the two active connections that the user already has to the app server. Does anyone have any suggestions on how to get around this? I'm trying to now write the report to the server, and provide the browser with a url, but it seams as though the connection isn't totally closed even though I close the response printwriter.... Any suggestions would be greatly appreciated....

    Unfortunately I dont have an answer to your question, but:
    If the reports are large/long running, should they be generated on demand? You could schedule the reports to be generated every day, month or whenever appropriate, stored on the server and then quickly pulled by the user whenever needed.

  • Calling a COBOL stored proc from Java Servlet

    I am trying to call a COBOL stored proc from a Java Servlet. The stored proc is stored on a DB2 database. I need to send 6 inputs to the COBOL stored proc and the output will be the return code of the stored proc. I'm not sure if I'm going about this the right way. This is how my code looks...
    public int callStoredProc(CallableStatement cstmt,
    Connection con,
    String sYear,
    String sReportNbr,
    String sSystemCode,
    String sUserId,
    String sModuleNbr,
    String sFormId){
    int iParm1 = 0;
    try{
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException ex){
    System.out.println("Failed to locate database driver: "
    + ex.toString());
    return iParm1;
    try{
    cstmt = con.prepareCall("{? = CALL MKTPZ90C
    cstmt.registerOutParameter(1, Types.INTEGER);
    cstmt.setString(2, sYear);
    cstmt.setString(3, sReportNbr);
    cstmt.setString(4, sSystemCode);
    cstmt.setString(5, sUserId);
    cstmt.setString(6, sModuleNbr);
    cstmt.setString(7, sFormId);
    cstmt.execute();
    iParm1 = cstmt.getInt(1);
    CloseSQLStatement(cstmt);
    catch(SQLException ex) {
    CloseSQLStatement(cstmt);
    System.out.println("SQL exception occurred:" +
    ex.toString());
    return iParm1;
    return iParm1;
    Could someone tell me if this is the right way to go about doing this?
    Thanks!!!!!!

    I didn't see the code where you create the database connection (variable "con"). However, the answer to your question "Is this the right way...", for me, is "Anything that works is the right way." So try it. That's a first approximation, but once you have something that works you can start on improving it, if that becomes necessary.

  • Inputting an excel file to the java servlet program

    Hi,
    How can I input an excel file into the java servlet program? I am using POI HSSF programming to read the content of that excel file.I have created a form that will accept the path from the user and in the servlet program, I have called a post method to retrieve the path of the file. I am getting the path of the file as a string.Then I have to access the file to read the data. But it is not working. What should I do?.Please help me.
    I have created an html file to create a form that will ask the path of the file to be loaded into the servlet program.Please give me a solution,thanks in advance. The servlet program that receives the file is shown below. It just only take the name of the file and prints if that is ok.
    <html>
    <body bgcolor="green">
    <center>
    <form method="post"  action="http://localhost:8080/examples/servlet/Ron1">
    <table>
    <tr>
    <td><B>ENTER THE PATH OF THE FILE</td>
    <td><input type=file name="path"></td>
    </tr>
    </table>
    <input type=submit value= "submit" >
    </form>
    </body>
    </html>
    import java.io.*;
    import javax.servlet.*;
    import java.lang.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import com.oreilly.servlet.MultipartRequest;
    import org.apache.poi.hssf.usermodel.*;
    public class Ron1 extends HttpServlet
       public void doPost(HttpServletRequest request, HttpServletResponse response)   throws IOException, ServletException
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            String u = request.getParameter("FileToUpload");
            out.println("The Path is "+u);
            System.out.println("The path is "+u);
            MultipartRequest multi = new MultipartRequest(request,u,10 * 1024 * 1024);
            System.out.println("path is "+u);
            Enumeration files = multi.getFileNames();
            File fUploadedFile = null;
            String sFileName = "";
            out.println("path is "+u);
            while(files.hasMoreElements())
                            String name = (String)files.nextElement();
                            out.println("file is "+name);
                            sFileName = multi.getFilesystemName(name);
                            String type = multi.getContentType(name);
                            fUploadedFile = multi.getFile(name);
                    FileInputStream fis= new FileInputStream(fUploadedFile);
                   HSSFWorkbook wb=new HSSFWorkbook(fis);
                    System.out.println("The path is "+u);
                    out.println("File has identified successfully\n");
                    out.close();
       }

    Hi,
    Can you try to use classes from java.net package (URL, URLConnection) to pass the contents of excel file to servlet?
    HTH
    Vishal

  • 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

  • How to get a CA certificate installed in the web trust db from java servlet

    Hi all.
    Hi, I have a web-app that requires a client certificate from a CA. The CA cert is in the trust db of the webserver. And I would like to get the CA certificate (X509Certificate) corresponding to the issuer of the current client certificate of the request. Is there an easy way of doing this from a java servlet?
    I'm using Sun Java System Web Server 6.1
    Thanks in advance.

    Hi, thanks for your quick answer.
    I have to check the client certificate revocation status using ocsp protocol. I'm cheking ogro project ocsp library (http://dev.globus.org/wiki/Incubator/OGRO) to check this status against my CA validator agency. In order to use this library in my servlet to check the status I need both the client cert and the issuer cert. So that is why I need to get the CA cert from my trust db.
    There is another way, I have the cert as file (the same I used to import the CA cert in my trust db), and I get the cert from the file. With this cert and the cert from the client I do the ocsp request and it works. But I trying to avoid having the CA cert in a file and recover the cert from the trust db.
    Thanks

  • When Streaming a PDF from a java servlet I get a grey screen on the Adobe Reader X plugin.

    I work on a webapp where we serve pdfs to clients by streaming via java servlets. Once we began to use Reader X we noticed that in IE the pdf will load Reader X with a grey screen. Chrome and firefox both work perfectly fine. If we use Adobe 9 it also works fine. We have no control over what our users use so any client side fix is not useful.
    We serve these pdfs to our user by opening a popup window to a url that streams the pdf directly to the response. We have noticed that if we have one popup window that has hit the grey screen - each new pdf in a popup works correctly - as long as the original grey screen is up, once all popups are closed the problem happends again. Refreshing the window with the grey screen will also show the pdf correctly.
    The problem is very similar to what is described here:
          http://forums.adobe.com/message/3335266
    However, we are not setting any caching headers - I have full control over what we can send and I have tried the suggestions - nothing works. Any ideas how to resolve this?

    You are prevented from Airplay mirroring certain things like DVD content as the material is usually protected so you get a checkerboard type display.  I think there is a theoretical risk that the Airplay stream could be intercepted and the protected video copied, albeitin lower quality.
    Apple may be being cautious or are required to do so with the DVD player app by movie studios/licensing authorities.  It makes no sense to the average consumer who is just trying to send their purchased DVD to the TV via the computer and AppleTV.
    Playback in something like VLC should work - not tried it myself but others have commented it doesn't have the restriction.

  • Is java servlet a good way for developing a website

    Hi,
    i am developing a website that has to download huge data and upload huge data .also money transactions through credit cards need to be involved.is java servlet a good way to do this or should i use an ejb or any other technology.
    Any help is appreciated.

    Thanks for the reply.But di i need to use threading of some sort or can i directly write private methods to fulfill the purpose.Also is there any way my servlet can recognise when a device is connected to a usb port of local machine
    any help is appreciated

  • XML Reading Using Java Servlet

    I need some help in reading xml file using java servlet.
    May i have some sample codes to read xml files?
    I would really appreciate your help. Thanks!!!

    This grabs a url and parses it with a servlet.
    URL befreeUrl = new URL(urlString);
    uri = new URI(urlString);
    URLConnection yc = befreeUrl.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    factory.setValidating(true);
    out = new OutputStreamWriter(System.out, "UTF8");
    DefaultHandler handler = new BeFreeRequestSAXParser(); /* custom handler class */;
    parser.parse(uri.toString(), handler);
    in.close();

  • Java servlets - JDBC

    hi,
    I have a problem... i would like to fetch some strings from the database using JDBC and create a tree structure using java servlets to be displayed on a browser using html.
    Currently i have tried using a hashtable as well as defaultmutabletreenode, both of which grew complicated and did not give the desired results.
    Pls help...

    I tried using both a DefaultMutableTreeNode
    containing all the other nodes as child nodes and a
    hashtable with a series of internal hashtables -- and
    passed it to the servlet displaying the html
    l content.
    Is there a better/simpler data structure to use in
    this case other than a Hashtable and a
    DefaultMutableTreeNode?How should we know? You're asking what is better to solve your problem, without saying what your problem is. (Hint: "I can't do this" or "It doesn't work" are not useful problem descriptions.)
    If I were doing this, and if I had to build a tree structure in memory before producing HTML from it, I would use DefaultMutableTreeNode. But then I don't know anything about your problem.

  • How to call java servlet using webservice in webdynpro abap?

    hi all,
                  we have a requirement to connect to non - sap database through webservices. But they do have a java servlet which has a data to get. please help me in this regard.
    Regards,
    Murthy.

    This is not a web dynpro ABAP related question.  Please only post questions in this forum that are directly related to Web Dynpro ABAP.

  • How can I include a portal component look and feel in a java servlet

    Does any body know how can i include a portal component look and feel (tables, buttons, etc) in a java servlet?

    Hi José,
    I don't think that is possible. But you can import the css files that ep uses for its look and feel and try to give your web pages similar look and feel. The tables and other controls used in EP are totally different and are done through complex JavaScript coding instead of simple HTML tags. If you want exact lok and feel then i thin you must go for a Webdynpro based application rather then a J2EE application with JSPs.
    Regards,
    Guru.
    PS: Give points for helpful replies.

  • Location of java servlet (not jsp) deployed on Java Stack

    Hello,
    Why this forum? this post is related to the way of calling a java servlet deployed on the java stack, so it's related to the structure of the stack than to real java programming.
    Usually, I develop JSP servlets which are easily called either with a mapping or not. I have deployed now a java servlet and added a mapping to it by modifying the xml source itselft in its descriptor, but after deployement I am not able to reach the resource.
    In the windows explorer of the java stack I find in j2ee>cluster>server>apps my application as follows:
    app_ear>servlet_jsp>app>root>WEB-INF>classes>my class files
    app_ear>servlet_jsp>app>root>app.jsp
    This time it's not a jsp that I want to call: app/app.jsp but my java servlet which lies in the classes subdir.
    Could someone help my to achieve this or is it the wrong way, we can only request jsp applications?
    Kind regards,
    Tanguy Mezzano

    Hi Vladimir,
    here's my web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <display-name>WEB APP</display-name>
         <description>WEB APP description</description>
         <servlet>
              <servlet-name>SSORedirect3.jsp</servlet-name>
              <jsp-file>/SSORedirect3.jsp</jsp-file>
         </servlet>
         <servlet-mapping>
              <servlet-name>AuthenticatorServlet</servlet-name>
              <url-pattern>/SSOredirect3</url-pattern>
         </servlet-mapping>
         <security-constraint>
              <display-name>SecurityConstraint</display-name>
              <web-resource-collection>
                   <web-resource-name>WebResource</web-resource-name>
                   <url-pattern>/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>POST</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <role-name>DefaultSecurityRole</role-name>
              </auth-constraint>
         </security-constraint>
         <security-role>
              <role-name>DefaultSecurityRole</role-name>
         </security-role>
    </web-app>
    And in my jsp file, I have a form with this kind of code:
    <form name="xyz" method="GET" action="http://j2eeserver:50000/SSOredirect3/SSOredirect3">
    I get this error in my logs:
    com.sap.engine.services.servlets_jsp.server.exceptions.ServletNotFoundException: Requested resource [SSOredirect3/servlet/AuthenticatorServlet] not found.
    Exception id: [000C299F469E00650001D8E900000CCC000458E27823275B]#
    Best regards,
    Tanguy Mezzano

Maybe you are looking for

  • How to modify the DN of an entry in ods schema in Oracle Internet Directory

    Hi, I want to modify dn of an entry in ods schema. Now my dn is: uid=1234567,cn=Users,dc=brand,dc=com and I want to change to 'uid=Tester001,cn=Users,dc=brand,dc=com'. Here 'Tester001' is a value of 'sn'. I have to replace the value of uid=1234567 to

  • Dynamic names for I$ ,C$ and E$ tables in ODI

    Dear ODI Team, We have a requirement where we are loading header data and then line data in our Package.ODI internally creates work tables to load data into target tables.If multiple sessions of the same interface is executed at the same time the I$t

  • Standard variable of PO for MIRO Transaction

    hi,       durinf transaction MIRO, when we hit pricing procedures then i want the standard variable for PO(ekko/ekpo) flowing in the pricing procedure so that i can use it in pricing procedure. Thanks, Gaurav

  • How to make a sublayer from an existing layer

    Hi I have two layers and I want to put the second layer into the first one. The second becomes a sublayer. How can it be done ?

  • How to Down grade the IOS7 to iOS 6 ?

    Hi, everyone, When using ios 7 for my iPad 2 is without any problem. Once upgraded to iOS 7, the wifi need to connect and reconnect from time to time or at any time when browsing the Safari that made me feel irritated .... Can any senior user advise