Help! New to Servlets.

Hi,
I am kind of new to servlets.
I have developed an application in Java using JAI which displays multipage tiff images. But i would like to create a servlet which does the same thing. If anybody has any documents or examples on Servlets which displays images, I would appreciate if they can post it or e-mail me at [email protected]
Thanks In advance.
Sam

first, a servlet ist not able to display an image directly. all a servlet can to (to the client) is to send a html. but as as you sure know it's easy to place an image tag in the html that points to the image. if the image already exists everything is already done. if oyu need to create the imgae severside just build a special command in the url that lets the servlet know it has to send a special image (you pass the needed parameters in the url). then you send the picture information back. make sure that you set the right header information, specialy the right content-type so the browser realizes that it's a picutre you are sending.

Similar Messages

  • Help,JSP and SERVLETS!

    hello:
    i've downloaded ECLIPSE 3.2,TOMCAT 5.5 .
    i tried to build simples examples o servlets but i failed could you please tell me how to proceed?i'm new at this plus i've got a project to do with all this so plz can you give some links to go,i tried but no links was clear.
    i've got to give to my professor an examples executed (servlets,jsp)
    thank you

    HISSO wrote:
    i wil give up on talking about stupid gossip
    you must act professional and i you can't help it's ok
    so plz i juste want help
    i'm so busy finishing my studies
    when it comes to talk about development with tomcat and eclipse together i'm new so i need some advices,so plz let's be serious!
    i'm working hard to finish my project!Try to communicate less like a monkey with electrodes attached to it's genitals. This means stop using words like "plz" and write "please" instead.
    If you want specific help with a specific problem then you should ask a specific question. "help, JSP and SERVLETS" is not a specific question. And you should also note that if your specific question is about Tomcat specifically or Eclipse specifically then you are in the wrong place to begin with.
    So do you want to try again?

  • Help! Simple Servlet Problem

    hi,
    I am new to servlets. I am trying to connect to database and retrive firstname and lastname and display it. When i run it i get a blank page. Can someone tell me what am i doing wrong.
    Here is the code.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.servlet.ServletException;
    public class DisplayAll extends HttpServlet{
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
    res.setContentType("text/html");
    PrintWriter pw = res.getWriter();
    try{
    Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
    Connection myCon = DriverManager.getConnection
    ("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
    Statement myStmt = myCon.createStatement();
    myStmt.execute("SELECT * FROM PINFO WHERE POLICYNUMBER=B05007584");
    ResultSet mySet = myStmt.getResultSet();
    while(mySet.next()){
    String fname = mySet.getString("FIRSTNAME");
    String lname = mySet.getString("LASTNAME");
    pw.println("<html>");
    pw.println("<body>");
    pw.println("Firstname: " + fname);
    pw.println("Lastname: " + lname);
    pw.println("</body>");
    pw.println("</html>");
    myStmt.close();
    myCon.close();
    catch(SQLException e){
    catch(ClassNotFoundException e){
    }

    You are putting <HTML><BODY> inside the while loop. Try the following and also close the statement and connection in "finally" block as opposed to in "try" block itself.
    pw.println("<html>");
    pw.println("<body>");
    while(mySet.next()){
    String fname = mySet.getString("FIRSTNAME");
    String lname = mySet.getString("LASTNAME");
    pw.println("Firstname: " + fname);
    pw.println("Lastname: " + lname);
    } //end while()
    pw.println("</body>");
    pw.println("</html>");
    }//end try
    catch(SQLException e){
    finally
    myStmt.close();
    myCon.close();

  • New to Servlet Technology

    Hi,
    i am new to servlets. Can anyone tell me how can i compile and run a java servlet. ie what do i need i mean application servers and webservers.
    Thanks in advance
    byee

    hi anansmithi,
    Thanks for the reply
    i have installed Tomcat 5.5.4 on my system and its working fine. i have written a small servlet program
    can you tell me how how can i compile and run a servet using tomcat 5.5.4
    thanks in advance
    byeee

  • New Bie help with MySQL & servlet

    Hi,
    I am trying to execute a small action... some how my code does not work. All it shows is a blank page with no error....
    Can any one help me to optimize this code so that it works?
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package oneword;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.Statement;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Random;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Register extends HttpServlet {
        private String name = null;
        private String emailID = null;
        private String nameDB = "jdbc:mysql://localhost:3306/register";
        private String mysqlUser = "root";
        private String mysqlPassword = "abc";
        private String mySqlJdbcDriver = "com.mysql.jdbc.Driver";
        private Connection conn = null;
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, ClassNotFoundException, SQLException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            name = request.getParameter("_name");
            emailID = request.getParameter("_email");
            try {
                Random generator = new Random();
                int activationPassword = generator.nextInt(100000);
                Class.forName(mySqlJdbcDriver);
                conn = (Connection) DriverManager.getConnection(nameDB,mysqlUser,mysqlPassword);
                Statement statement = (Statement) conn.createStatement();
                String sqlCommand = "INSERT INTO userdata(name, email, validation, " +
                        "banned, activatepassword, password)values("+name+", "+emailID+", 0, 0,"+activationPassword+", 'ddd')";
                statement.executeQuery(sqlCommand);
                out.println(name);
                out.println("<br>"+emailID);
                out.println("rows affected:");
                conn.close();
            } catch (SQLException ex) {
            // handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
            } finally {
                out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
         * Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
    }Thank you

    A blank page usually indicate that an exception is been thrown but cannot be displayed because the response is already started/committed/processed. Just read the appserver's logs as usual for the details.
    Your servlet class does way too much. You're mingling all the processing steps together in one class. This is simply asking for trouble. Use a DAO class for accessing the DB. Use a JSP file for presentation. Use a business object to process the input/output data. Use a servlet for controlling the request. To start off, you may get some ideas out of this article and the JSP/Servlet follow-up: [http://balusc.blogspot.com/2008/07/dao-tutorial-data-layer.html].
    Oh, your JDBC code is not safe against SQL injection attacks either.

  • New with Servlets - please help

    Hello:
    I am using JDev to work with JSPs/Servlets .Can someone please direct me how to setup JDev to work with JSPs and Servlets.
    Question 1: I downloaded JDev Full Version which said that it included JDK1.5 . But I don't know where it installed it. I just unzip the folder. Do I have to install JDK differently?
    Q2: Using Tomcat Application Server - it asked to locate the folder where JRE is installed . Where can I get that info.
    Q3 : How to setup Servlets so that I can load a servlet file in the browser. I created a "Hello World" app using Servlets but I can't load it .
    I will appreciate you help.
    THanks

    user517625,
    First, for your information, Tomcat is a servlet container, not an application server. Second, Oracle JDeveloper includes an [embedded] application server: OC4J. So you don't really need Tomcat if you only want to create and test some servlets and JSPs. JDeveloper includes extensive "help" information and sample code that shows you how to create servlets and JSPs.
    Good Luck,
    Avi.

  • Need urgent help on Applet-Servlet communication

    Hi,
    I have a applet having two button A and B. A passes querystring "Select name from test where letter = A" when button A is pressed while B passes querystring "Select name from test where letter = B" when button B is pressed. The applet passes the string to a servlet which in turn queries a database to get the output name back to the applet. Both compiles fine but while running I am getting the following error:
    java.io.IOException:
    Any help is appreciated in advance. Thanks. Regards
    THE APPLET CODE:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class ReinApplet1 extends Applet implements ActionListener
    TextField text;
    Button button1;
    Button button2;
    TextArea taResults;
    String qryString1;
    public void init()
    button1 = new Button("A");
    button1.addActionListener(this);
    add(button1);
    button2 = new Button("B");
    button2.addActionListener(this);
    add(button2);
    taResults = new TextArea(2,30);
    add(taResults);
    // text = new TextField(20);
    // add(text);
    public void actionPerformed(ActionEvent e)
    Object obj = e.getSource();
    if(obj == button1)
    String qryString = "select name from test where letter = A";
    executeQuery (qryString);
    if(obj == button2)
    String qryString = "select name from test where letter = B";
    executeQuery (qryString);
    public void executeQuery (String query)
    String qryString1 = query;
    try
    URL url=new URL("http://localhost:8080/examples/servlet/ReinServlet1");
    String qry=URLEncoder.encode("qry") + "=" +
    URLEncoder.encode(qryString1);
    URLConnection uc=url.openConnection();
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setRequestProperty("Content-type",
    "application/x-www-form-urlencoded");
    DataOutputStream dos=new DataOutputStream(uc.getOutputStream());
    dos.writeBytes(qry);
    dos.flush();
    dos.close();
    InputStreamReader in=new InputStreamReader(uc.getInputStream());
    int chr=in.read();
    while(chr != -1)
    taResults.append(String.valueOf((char) chr));
    chr = in.read();
    in.close();
    // br.close();
    catch(MalformedURLException e)
    taResults.setText(e.toString());
    catch(IOException e)
    taResults.setText(e.toString());
    THE SERVLET CODE:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    public class ReinServlet1 extends HttpServlet
    Connection dbCon;
    public void init() throws ServletException
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    dbCon=DriverManager.getConnection("jdbc:odbc:Sales");
    catch(Exception e)
    System.out.println("Database Connection failed");
    System.out.println(e.toString());
    return;
    public void handleHttpRequest(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
    PrintWriter out = res.getWriter();
    res.setContentType("text/html");
    String qery=req.getParameter("qry");
    try
    Statement st=dbCon.createStatement();
    ResultSet rs= st.executeQuery(qery);
    while(rs.next())
    out.println(rs.getString(1));
    catch(SQLException e)
    System.out.println(e.toString());
    return;
    out.println();
    out.close();
    THE HTML CODE
    <html>
    <applet code = ReinApplet1.class width=500 height=300>
    </applet>
    </html>

    Since you are just using Strings, it's easier to use an ObjectOutput/InputStream. See http://forum.java.sun.com/thread.jsp?forum=33&thread=205887 for a detailed example.
    Cheers,
    Anthony

  • ## NEW XSQL Servlet 0.9.9.1 OUT TODAY ##

    The new release of XSQL Pages and the XSQL Servlet is out today here on OTN. For complete information on what's new, and a much-improved "how to install" section, see:
    http://technet.oracle.com/tech/xml/xsql_servlet/htdocs/relnotes.htm
    The brand-new, unified demo, on-line help system is also staged on the live server at:
    http://technet.oracle.com/tech/xml/demo/demo1.htm
    and is included in the release. It's all built using XSQL Pages and XSLT stylesheets.
    Lot's of new features and enhancements based squarely on all of YOUR feedback, here on the OTN XML Forum.
    Keep the questions and suggestions coming.

    Richard,
    I have just applied patch to upgrade from Portal 3.0.9 to 3.0.9.8.1 (Patch applied to loginserver and portal schema) and the External Applications that were previously set up have gone from the portlet.
    Does this relate to your note at the bottom:
    "Minor issues with Bulk action. 1840420 CUSTOM WRITTEN EXTERNAL AUTH MODULE NEED TO BE UPDATED AFTER 3.0.9 UPGRADE SSOXOID.PKB DOESN'T LOAD.
    External authentication modules that were written before 3.0.9 need to be updated after upgrading to 3.0.9. ssoauthx.pks is updated in 3.0.9 and contains additional routines that need to be implemented." ??
    If I go to the "Login Server Administration" portlet and select the link "Administer External Applications" I get a list of 5 External Applications that have previously been set up.
    If I go back to the Home Page and select "customize" on the "External Applications" portlet I get the message "Your Login Server administrator has not registered any external applications".
    Does that mean I should just run 'ssoauthx.pks' & 'ssoxoid.pkb' or do I need to do something else ??
    Thanks
    Simo

  • Help needed in servlet sessions

    hi,
    I m having following servlet with the logon and logout request..
    and my problem is that I don't want 2session with same clientID
    means a client want to log in ( who is currently logged in with say ClientID=5)
    with same ClientID (=5) then he won't be able to do that.. and i m invalidating the session
    when client hits logout button ( i don't want to use session time out) but what if he just
    shut down his browser without logout. In that case i want to invalidate that session
    immediately (as it is necessary for first requirement) i.e. if the session resides in memory
    than client won't be able to log in again untill that session automatically invalidated...
    so help me!!!!
    thanks
    bhups
    some part of my code in which i m getting and invalidating session is given below.
    class myServlet extends HttpServlet{
    void doGet(req,res)
    Client _client=null;;
    HttpSession _session=req.getSession(false);
    if(_session!=null)
    client=(Client)session.getAttribute("_client");
    if(requestID.equals("Login"))
    String ClientID=req.getParameter("ClientID");
    String Password=req.getParameter("Password");
    String AuthenticationStatus=Authentication(ClientID,Password);
    if(AuthenticationStatus.equals("Authenticated"))
    _session=req.getSession(true);
    session.setAttribute("client",new Client(Integer.parseInt(ClientID),Password));
    res.sendRedirect("./inbox.html");
    else
    throw someException();
    if(requestID.equals("Logout"))
    if(_client!=null)
    _session.invalidate();
    res.sendRedirect("./login.html");
    class Client
    private int ClientID;
    private String Password;
    public Client(int cid,String password)
    ClientID=cid;
    Password=password;
    public int getClientID()
    return this.ClientID;
    }

    Hey this can be done using javascript
    U have to capture the window close event of the browser and for that event write a javascript function
    which calls the logout.jsp page or any other necessary servlets to do the logout process.
    a dummy example is given here
    someJsp.jsp
    <html>
    <head>
    <script>
                 function closeSession()
                                 window.navigate("logoff.jsp");
    </script>
    </head>
    <body onUnload="closeSession()">
    </body>
    </html>

  • Need help with applet servlet communication .. not able to get OutputStream

    i am facing problem with applet and servlet communication. i need to send few image files from my applet to the servlet to save those images in DB.
    i need help with sending image data to my servlet.
    below is my sample program which i am trying.
    java source code which i am using in my applet ..
    public class Test {
        public static void main(String argv[]) {
            try {
                    URL serverURL = new URL("http://localhost:8084/uploadApp/TestServlet");
                    URLConnection connection = serverURL.openConnection();
                    Intermediate value=new Intermediate();
                    value.setUserId("user123");
                    connection.setDoInput(true);
                    connection.setDoOutput(true);
                    connection.setUseCaches(false);
                    connection.setDefaultUseCaches(false);
                    // Specify the content type that we will send binary data
                    connection.setRequestProperty ("Content-Type", "application/octet-stream");
                    ObjectOutputStream outputStream = new ObjectOutputStream(connection.getOutputStream());
                    outputStream.writeObject(value);
                    outputStream.flush();
                    outputStream.close();
                } catch (MalformedURLException ex) {
                    System.out.println(ex.getMessage());
                }  catch (IOException ex) {
                        System.out.println(ex.getMessage());
    }servlet code here ..
    public class TestServlet extends HttpServlet {
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
             System.out.println(" in servlet -----------");
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            ObjectInputStream inputFromApplet = null;
            Intermediate aStudent = null;
            BufferedReader inTest = null;
            try {         
                // get an input stream from the applet
                inputFromApplet = new ObjectInputStream(request.getInputStream());
                // read the serialized object data from applet
                data = (Intermediate) inputFromApplet.readObject();
                System.out.println("userid in servlet -----------"+ data.getUserId());
                inputFromApplet.close();
            } catch (Exception e) {
                e.printStackTrace();
                System.err.println("WARNING! filename.path JNDI not found");
            } finally {
                out.close();
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            System.out.println(" in foGet -----------");
            processRequest(request, response);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            System.out.println(" in doPost -----------");
            processRequest(request, response);
         * Returns a short description of the servlet.
         * @return a String containing servlet description
        @Override
        public String getServletInfo() {
            return "Short description";
        }// </editor-fold>
    }the Intermediate class ..
    import java.io.Serializable;
    public class Intermediate implements Serializable{
    String userId;
        public String getUserId() {
            return userId;
        public void setUserId(String userId) {
            this.userId = userId;
    }

    Hi,
    well i am not able to get any value from connection.getOutputStream() and i doubt my applet is not able to hit the servlet. could you review my code and tell me if it has some bug somewhere. and more over i want to know how to send multiple file data from applet to servlet . i want some sample or example if possible.
    do share if you have any experience of this sort..
    Thanks.

  • Help compiling BookStore  SERVLETS tutorial classes

    I am new to Java. Please be patient with my errors. I need help with compiling the servlets given as part of the SERVLET tutorial. I have previously installed JDK1.3.1.01. I have also downloaded the JSDK2.1 as part of the tutorial. As part of the tutorial several servlet classes were provided. Almost all of them have these import statements.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    However, the javac is unable to compile the classes. I think it is because javax.servlet is installed under /root/jsdk and JDK is installed under /usr/java/jdk1.3/bin. I can find the javax directory under /root/jsdk but not under /usr/java. I tried giving the classpath option to javac as:
    javac -classpath /root/jsdk BookStoreServlet.java
    But it did not work.
    I believe once the servlet classes are compiled it will be possible to view them from the JSDK browser. I was able to successfully start the jsdk browser with startserver script given with the distribution. And the example SnoopServlet worked fine.
    In summary, I believe the authors of the tutorial left out the details of compiling the classes and viewing from browser. I could be wrong about it.
    I will appreciate any help from the users of the tutorial and anyone who knows servlets.
    Many thanks.
    Murthy

    i found this info on how to set the classpath in linux
    http://java.sun.com/products/jdk/1.2/docs/tooldocs/sola
    is/classpath-linux.htmlThanks imp-cat. I could compile the BookStoreServlet.java into its corresponding class. I get the following error when I try to run it. What should I do? Thanks. Regards. Murthy
    java BookStoreServlet
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

  • Strange problem. PLZ help!! Servlet+Excel

    Hello,
    I have a problem downloading excel files, I generate a excel file in the server using jakarta, i download the file and when i open it, it tells me that "File error: file may have been lost", but i can open it .
    My code:
                        res.setContentType("application/vnd.ms-excel");
                        res.addHeader("Content-Disposition",
                                  "attachment;filename="+fileName+".xls");
                        ServletOutputStream out = res.getOutputStream();
                        HSSFWorkbook wb = new HSSFWorkbook();
                        HSSFSheet sheet = wb.createSheet("sheet1");
                        HSSFRow headerRow = sheet.createRow((short) 0);
                        sheet.addMergedRegion(new Region(0, (short) 0, 2,
                        (short) 10));
                        HSSFCell headerCell =
                             headerRow.createCell((short) 0);
                        //add the date to the header cell
                        headerCell.setCellValue("The Bowling Score");
                        wb.write(out);
                        out.flush();
                        res.flushBuffer();
    Anyone can help me?
    Thanks

    I had a similar porblem....
    I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
    This is my code in servlet...
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet spreadSheet = wb.createSheet("Users");
    spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
    spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
    // Creating Rows
    HSSFRow row = spreadSheet.createRow(0);
    HSSFCell cell = row.createCell((short) 1);
    cell.setCellValue("Year 2005");
    cell = row.createCell((short) 2);
    cell.setCellValue("Year 2004");
    HSSFRow row1 = spreadSheet.createRow(1);
    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    cell = row1.createCell((short) 0);
    cell.setCellValue("Revenue ($)");
    cell = row1.createCell((short) 1);
    cell.setCellValue("25656");
    cell = row1.createCell((short) 2);
    cell.setCellValue("15457");
    FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
    ServletOutputStream out = response.getOutputStream();
    wb.write(output);
    output.flush();
    output.close();
    forward = null;
    In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
    Thanks in advance...

  • New to Servlets

    there is no bin folder in jswdk that i have downloaded. so how do i host my servlet cause i cant trace teh servletrunner as the tutorial suggests !!??
    anyone for help please.
    thanks

    i tried running the Httpservlet from the command line
    and i keep getting exeptions that has sumtin to do
    with main(). but there is no main() in the code. is it
    possible to run the Httpservlet from the command line?
    and how do i actually run the Httpservlet with
    tomcat?
    thanx in advance!!!as far as i know, you cant do that. Correct me if i am wrong. As others guys mentioned before, go to http://www.moreservlets.com There got all the basics you need to get started, esp. the nice instruction about install Tomcat 4 or 5. It looks like a bit overwhelming and confusing when you read those insturctions at the very first time, particuarly when you are really new to this area. But dont worry, they are not rocket science. just make yourself calm down, have a cup of java, read and follow through these instructions carefully, then you would get it down. Feel free to ask any more questions.
    Hope it helps.

  • Help connecting to servlet

    Hi
    I have made a simple test midlet which connects to a servlet on the web and reads a string.
    Now when I test this all out n my local computer it works fine however
    when I changed the url in the midlet to read from the real servlet at my website I get errors. I have included the relevant midlet function and the console error report.
    Heeeeeeelp!
    private String connect()
         String myString ;
         HttpConnection hc = null;
         InputStream in = null;
         String url = "http:64.202.176.93:9080/freshnetproj/testservlet";
         try
         hc = (HttpConnection)Connector.open(url);
         in = hc.openInputStream();
         int contentLength = (int)hc.getLength();
         byte[] raw = new byte[contentLength];
         int length = in.read(raw);
         in.close();
         hc.close();
         // Show the response to the user.
         myString = new String(raw, 0, length);
         catch (IOException ioe)
              myString = ioe.toString();
         return myString;
    the consolse report says:
    [j2mepolish] Generic/Midp2Cldc11: Incorrect domain name, switching to 'unidentified_third_party'
    [j2mepolish] Generic/Midp2Cldc11: Uncaught exception java/lang/IllegalArgumentException: missing host in URL.
    I'm pretty sure my url is correct though
    Thanks!

    Ofcourse! what a silly thing to forget!
    I feel all embarresed now
    Thanks for the helpit may arrive something. a new eye on a project could be a good help :-)

  • Step By Step Instructio​ns !!!! HELP NEW USER!

    Step by step tutorial on how to create a project from A to Z. I am a new user, and i am tired of all the tutorials NI provides, they all talk about creating some bullshit waveform or making some easy calculator vi. They never talk about the real stuff, example, how to start a project, create your vi, compiling or putting together all the vi's, compile everything together and than creating an EXE. Holly shit that's all i am asking for is an idiots guide is it that hard for NI to make ! Can anyone out there direct to something to figure this out maybe a book, article, web page something!!!   And no thank you i don't need some sales guy calling me trying to sell NIN bullshit training classes, i have been to them and all the instructor could talk about is creating a ridicolous sine wave genarator (WoW) 

    I am sure NI would be very happy to hear about any issues with the LabVIEW help that could be confusing to new users.
    Here's a link to the LabVIEW help on organizing an managing projects:
    http://zone.ni.com/reference/en-XX/help/371361D-01​/TOC16.htm
    Have you read it and do you still have problems? What was not clear?
    Genci wrote:
    ..., compile everything together and than creating an EXE.
    How to built an application Step by step.: http://zone.ni.com/devzone/cda/tut/p/id/3303
    You should also be aware that you cannot buit an application using LabVIEW base or full.
    You need LabVIEW professional or you need to purchase the application builder.
    Genci wrote:
    ...tired .. bullshit ... Holly shit ...idiots ...bullshit ..ridicolous ...
    These are all non-techical terms and not very descriptive in the context of LabVIEW. Could you be a bit more specific on what kind of problems you encountered?
    It would also be important to know your programming background? Are you experienced in any other programming environment? Is labVIEW your first attempt at programming? Are you familiar with general programming terms? Are you trying to program for personal enjoyment, for school, or as part of a job. If your employer forces you to switch to LabVIEW, maybe he could send you to some NI classes.
    What is your LabVIEW version?
    As anything, there is always an initial hurdle that needs to be overcome before becoming familiar in a new environment. Fortunately, this threshold is very low in the case of LabVIEW and you should be up and running after a couple of hours. Mastery takes a bit longer, of course.
    Your best bet is to ask a more specific question here in the forum whenever you get stuck. Good luck and enjoy the ride.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Flash Player Does Not Work After Installing on Windows XP

    I had been playing a shockwave game for several days and had completed 19 of 35 levels. When I went to play it again, I received a message that I need to update to a newer flash player. I downloaded it successfully, but it does not work. There is no

  • Profit Centre posting via MR21

    I'm posting a material price change via transaction MR21.  I've changed the GL account to a P&L account and so aswell as an FI posting I'd also like a PA posting, a profit centre posting and a CO posting.  These are all happeningok except for the fac

  • How to get the .class file for the extended Controller .java file

    Hi, I did the below steps. 1. Created New OAWorkspace 2. Created New project 3. Imported the page .xml file 4. Added new .java file by extending the controller class 5. Added code in the .java file. 6. Ran the .xml file As I copied all the folders fr

  • Installing windows xp to a macbook

    is it even possible to install windows xp to a mac? where could I but the software? would i need some parralell software to if i wanted to be able to use mac os x and windows at say the same time? could i do this for windows vista? thnx john

  • Old photoshop user having trouble using elements

    Been using an ancient copy of Photoshop for years. Got a new computer, and figured it was time for an upgrade, so I bought Elements. I've been working with it for a few days and having tons of troubles. 1) Dell sold me Elements 8 instead of Elements