Servlet: incremental output

Dear All,
I have the following question.
I wrote a servlet that retreives about 20000 rows from my database and I have to show them on my Internet Explorer.
I have a for cycle that writes in the ServletOutputStream:
ServletOutputStream out = response.getOutputStream();
for (int i = 0; i < customerCount; i++)
out.print(getResultsRowHtml(i));
I would like to speed up the output (killing the wait-time) forcing the browser to render row by row ...
I tried this
ServletOutputStream out = response.getOutputStream();
for (int i = 0; i < customerCount; i++)
out.print(getResultsRowHtml(i));
out.flush();
but nothing happens. The browser shows the page as soon as the servlet reaches out.close() method.
Any idea?
REgards,
Tommaso T.

You could also try SET PAUSE >>> PAUSE ON. I have "SET PAUSE >>>" in my login.sql so that whenever I "SET PAUSE ON", I get ">>>" as the continuation prompt instead of the default (no prompt).
A nested-loop type of execution plan will tend to return rows as it fetches them, while a hash-join plan or one that uses sorting will usually have to finish processing all the rows before it can return any. This is the idea behind the ALL_ROWS and FIRST_ROWS hints.

Similar Messages

  • Save servlet html output as jpeg.

    Hello everybody,
    I have a servlet that creates an html page.
    The html consits of information from a database and displays a data sheet with images and text.
    I have been asked if the outputed data sheet can be saved as an image (jpeg).
    Is this possible?
    Thanks.

    I am can of confused how this works
    I know that there is more to do in order to create an
    image.First you have to make a desition, what do you need?
    * if you only want to save a data sheet i think the better solution is a Excel format file, for this yo coul take a look at http://jakarta.apache.org/poi/hssf/index.html
    * if you want to generate a pdf with images, tables, etc. yo should take a look at http://xml.apache.org/fop/
    * if you want to create a custom image i cant help you
    the proces to generate excel isnt dificult but to make a pdf is a little hard. but if you read the documentation and the examples you shouldnt have problems
    Jorge

  • Can't see my Servlet/JSP outputs

    {color:#0000ff}Hello there Java gurus,
    I'm really excited about Java but there seems to be something i'm missing out that is slowing me down. I understand the logic behind the Servlet and JSP technologies - having context root in the webapps subdirectory of the Apache Tomcat, placing other directories like servlets, WEB-INF, classes etc in their respective places and copying .class, .xml, and .html into the proper directory of webapps subdirectories- but still I can't execute properly to view the outputs of even the simplest Servlet and JSP codes.
    When I tried compiling my Servlet Java file to produce a .class file, it gave an error of "javax.servlet does not exist". What can I do again to make me execute my Servlets, because there's truely no javax.servlet in the Java subdirectory of my Program Files.
    Thanks in advance for making this guy smile.
    ***Smiles***{color}

    Ednut wrote:
    Thanks cutton_m for the response, but if you can be clearer on how to get the .jar files or any other file that'd help, i'd be happier. My jakarta-tomcat-5.0.25is successfully installed, and I really don't understand what u mean by j2ee libraries coming with the tomcat's container.
    You need the jars in your classpath.
    The jars came with the J2EE container - in your case tomcat.
    Just what should I do to get the output of my Servlets/JSP codes viewable?Get to build first would be a start.

  • Servlet to output a string

    It has been a long time since I worked on Java. Appreciate if anyone can tell me if there are other ways to output a string from a servlet. I tried using response.setContextType("text/plain");Thanks in advance.
    maharaJa

    Saish,
    Thanks for the info. Exact thing I was looking for. Appreciate your time!
    Thanks.
    mahrajA

  • Accessing a array through a servlet and outputting info in a JSP?

    I have researched and have not come up with any examples and no answer as to how to do this. Please help... The molecular2.java does all the computation. I will only include a snippet of it.
    This file is like this because I needed to return multiple items and could not find another way to do it.
    public String getResult(String mw)
    if(overallcount == 1.0)
    String overallcount 4 = String.valueOf(overallcount1);
    return overallcount4;
    else
    String overallcount3 = String.valueOf(overallcount);
    for(int i=0; i<j; i++)
    if(coeff[i] != 0.0)
    finalcoeff[i] = ((coeff/overallcount)*100);
    } // keep in mind that and array called element[], has already been filled
    return overallcount3;
    } public String getResult(String mw)
    if(overallcount == 1.0)
    String overallcount 4 = String.valueOf(overallcount1);
    return overallcount4;
    else
    String overallcount3 = String.valueOf(overallcount);
    for(int i=0; i<j; i++)
    if(coeff[i] != 0.0)
    finalcoeff[i] = ((coeff[i]/overallcount)*100);
    } // keep in mind that and array called element[], has already been filled
    return overallcount3;
    } Help with Code Tags (Toggle Plain Text) public String getResult(String mw)
    if(overallcount == 1.0)
    String overallcount 4 = String.valueOf(overallcount1);
    return overallcount4;
    else
    String overallcount3 = String.valueOf(overallcount);
    for(int i=0; i<j; i++)
    {if(coeff[i] != 0.0){
    finalcoeff[i] = ((coeff[i]/overallcount)*100);
    } // keep in mind that and array called element[], has already been filled}
    return overallcount3;}
    } public String getResult(String mw){
    if(overallcount == 1.0)
    String overallcount 4 = String.valueOf(overallcount1);
    return overallcount4;
    else
    String overallcount3 = String.valueOf(overallcount);
    for(int i=0; i<j; i++)
    if(coeff[i] != 0.0)
    finalcoeff[i] = ((coeff[i]/overallcount)*100);
    } // keep in mind that and array called element[], has already been filled
    return overallcount3;
    I want to pass the information hat I get here to a servlet that looks like this and is called MoleCalc.javapublic class Molecalc extends javax.servlet.http.HTTPServlet implements javax.servlet.Servlet {
    protected void doGet (...)
    RequestDispatcher disp = request.getRequestDispatcher("jsp/Calculators/MoleCalc.jsp");
    if((request.getParameter("submit")==null) || (request.getParameter("submit").length() == 0))
    {//do nothing
    else //user hits submit button
    if((request.getParameter("mole") != null) && (request.getParameter("mole").length() > 0))
    String moleS = request.getParameter("mole");
    String moleStr = "";
    String overallcount = "";
    try
    overallcount = Molecular2.getResult(moleS);
    if(overallcount == "1.0")
    request.setAttribute("mole","");
    request.setAttribute("moleformula","");
    request.setAttribute("errormsg", "Did no t enter a proper equation");
    }public class Molecalc extends javax.servlet.http.HTTPServlet implements javax.servlet.Servlet {
    protected void doGet (...)
    RequestDispatcher disp = request.getRequestDispatcher("jsp/Calculators/MoleCalc.jsp");
    if((request.getParameter("submit")==null) || (request.getParameter("submit").length() == 0))
    {//do nothing
    else //user hits submit button
    if((request.getParameter("mole") != null) && (request.getParameter("mole").length() > 0))
    String moleS = request.getParameter("mole");
    String moleStr = "";
    String overallcount = "";
    try
    overallcount = Molecular2.getResult(moleS);
    if(overallcount == "1.0")
    request.setAttribute("mole","");
    request.setAttribute("moleformula","");
    request.setAttribute("errormsg", "Did no t enter a proper equation");
    }Could someone please tell me how to implement the array into this code? I have tried everything that I can imagine but it is not working.
    Any help would be great.... Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Also....
    I am figuring that for the jsp, which is MoleCalc.jsp, that I would just do a couple of foreach statements.
    <form name = "moleformula" method="get" action="MoleCalc.java" onsubmit = "return vInputMoleformula(this);">
    <h3>enter the Molecular Formula: </h3>
    <td><input type="text" name="mole" id="mole" value="" maxlength="10" size="10"/> Molecular Formula </td>
    <input class="submitButton" type="submit" value="Compute" name="submit" /> <br />
    <h2> Molecular Weight = <c:out value="${moleformula}"/> g.</h2><br/>
    <br> The formula entered was: <c:out value="${mole}"/><br/>
    <h2><font color=red><c:out value="${errormsg}"/></font></h2><br/></form></div><form name = "moleformula" method="get" action="MoleCalc.java" onsubmit = "return vInputMoleformula(this);">
    <h3>enter the Molecular Formula: </h3>
    <td><input type="text" name="mole" id="mole" value="" maxlength="10" size="10"/> Molecular Formula </td>
    <input class="submitButton" type="submit" value="Compute" name="submit" /> <br />
    <h2> Molecular Weight = <c:out value="${moleformula}"/> g.</h2><br/>
    <br> The formula entered was: <c:out value="${mole}"/><br/>
    <h2><font color=red><c:out value="${errormsg}"/></font></h2><br/></form></div>

  • How to instruct servlet to output to another frame?

    Hi all,
    This is what my application is about:
    Display a page with 3 frames.
    The 1st frame is a form, and the user is to fill out the form and submit a post request. The servlet invoked will perform some query and generate a list of results with links in another frame.
    Then the user will click on a link and more computation will be performed and result will be displayed in the 3rd page.
    my first question is: how to generate the result in another frame using servlet? Is RequestDispatcher an answer? I've tried using RequestDispatcher to forward the request to the .jsp file which represents the 2nd frame but nothing in the 2nd frame happens when I submit the form in the 1st frame. Rather, the 1st frame displays a page with message "The page cannot be found."...
    My second question is: should I write 3 separate .jsp files for each frame? Do I need a jsp file for the 2nd frame? I don't really understand how I can generate result in the 2nd frame which will in turn generate other results in the 3rd page when the user submits request in the 2nd frame.
    Thanks for your attention. Your help will be greatly appreciated!

    Have a look at a problem posted by nalinisp today. It might help.

  • Servlet  output correct in ie and netscape, but not in portal

    I have a servlet that retrieves and xml document, applies a
    stylesheet, and uses PrintWriter to output the html.
    When I run the servlet, the output is correct in ie and netscape.
    So, I set the servlet up as a web portlet and have put it on a
    portal page.
    My problem: When I run the portal page, the mdashes and
    rsquotes, etc. show up in portal as question marks.
    I went into the provider.xml and added some information
    (contentType,charset), but that had no effect.
    Ideas appreciated.
    Thanks.

    I have been doing some research, and this appears to be some
    sort of character encoding/unicode problem.
    I have specified UTF-8 in my servlet. Does portal not work with
    UTF-8?
    Is there a setting somewhere that I can check in portal to
    verify what character encoding it is using? (ISO-8859-1, US-
    ASCII, etc?)
    This is a sample of my servlet code:
    public void DoGet(HttpServletRequest request, HttpServlet
    Response,response)
    throws ServletException, IOException
    DOMParser parser;
    XMLDocument xml,xsldoc;
    URL xslURL,xmlURL;
    String xmld = "";
    String xsld = "";
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    xslURL = createURL(xsld);
    parser.parse(xslURL);
    xsldoc = parser.getDocument();
    xmlURL = createURL(xmld);
    parser.parse(xmlURL);
    xml = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet(xsldoc,xslURL);
    XSLProcessor processor = new XSLProcessor();
    processor.processXSL(xsl,xml,out);
    Any advice appreciated.

  • REG:SERVLET OUTPUT STREAM

    I am trying to implement upload/view functionality..To view an uploaded txt file or html file,I am just flushing out the file contents into servlet's output stream..The content type has been set appropriately.
    The problem is for some html files ia m able to see the file contents in the browser,and for some html files,the browser displays a open/save dialog box..
    Can any1 explain me why this discrepency?Its the sam e code and same content type..why is it so?

    Thanks for ur reply...
    All i mentioned was in the same browser..PFB the code snippet
         ServletOutputStream pic = null;
         pic = response.getOutputStream();
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         byte b[] = new byte[5*1024];
         while(true)
              int bytes = in.read(b);
              if(bytes == -1)
                   break;
              baos.write(b, 0, bytes);
         response.setContentLength(b.length);
         b = baos.toByteArray();
         pic.write(b, 0, b.length);
         pic.flush();
         pic.close()

  • Writing to servlet output stream

    Hi All,
    I am writing to a servlet(imageservlet) output stream in a jsp page two times as follows:
    <img src="\imageservlet?key=x1">
    <img src="\imageservlet?key=x2">
    It is causing memory errors. Do I have to take special precautions?
    Thanks inadvance.

    Hi,
    THis is my servlet code.
    import java.io.*;
    import java.io.StringWriter;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.awt.Color;
    import com.trizetto.healthweb.service.GenerateImage;
    * Simple servlet to use with Image I/O generator
    public class GenerateImageServlet extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
         String className="PieChartGenerator";
         if(request.getParameter("keyName").equals("Pie"))
              className=PieChartGenerator";
         else if( request.getParameter("keyName").equals("Gantt") )
              className="GanttChartGenerator";
    try
    GenerateImage ge=
    (GenerateImage) Class.forName(className).newInstance();
    String type = ge.createImage(response.getOutputStream());
    response.setContentType(type);
    catch (Exception e)
    throw new ServletException(e);
    But this one does not generate image. The image is generated from the Graphics object of the Frame.
    Something like the following code:
    http://www.javaworld.com/javaworld/jw-05-2000/servlets/Servlets.zip
    http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets-p2.html
    http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets-p1.html
    I am using Java 1.1.
    I am running my app. in websphere. The error happens randomly while I am stopping the websphere application server.
    Thanks in advance.

  • Include to jsf  servlet output data

    hello
    my servlet transforms xml document by xstl and i want to include into my jsf page what servlet writes in outputStream
    i had tried facelet's ui:include, but it said that the path invalid
    what way can i go to resolve this problem?
    thank you
    Edited by: user10279326 on Dec 24, 2010 1:16 PM
    Edited by: user10279326 on Dec 24, 2010 1:16 PM

    You could use an URLConnection in a JSF backing bean to invoke the servlet, then output the result through a property of the backing bean.
    If we're talking about lots of data you might want to rethink your strategy a little. For example you could use Ajax to fetch the data from the servlet through the client side and display a 'processing' icon while it is busy loading the data. That way your page displays almost immediately and the servlet result will then display as soon as it is done processing.

  • Controlling JSP/servlet output buffering

    I'm doing some performance testing on some JSPs and I need to be able
              to separate client side rendering/javascript execution time from
              server side execution of the (JSP-generated) servlet.
              The normal way for the servlet generated from the JSP to behave is
              that the output stream to the browser is buffered - that is, as the
              servlet generates output it is written to the buffer in chunks and the
              buffer is written to the browser in chunks. On all but the shortest
              pages the content from the bottom of the JSP hasn't even been
              generated yet at the time the buffer starts writing to the browser.
              I want to turn this behavior off. I want no output sent to the browser
              until the whole output is generated. This way I can put timers in my
              client side Javascript and know they are measuring only the client
              side execution time, not the server side.
              Does anyone know how to do this?
              Eliot Stock
              Premiere Retail Networks
              San Francisco
              

    Hi Eliot,
              you can use the page directive's buffer and autoFlush attributes to
              control the size of the output buffer.
              <%@ page buffer="100kb" autoFlush="false" %>
              Here's a link:
              http://java.sun.com/products/jsp/tags/10/syntaxref10.fm7.html
              Nils
              Eliot Stock wrote:
              >
              > I'm doing some performance testing on some JSPs and I need to be able
              > to separate client side rendering/javascript execution time from
              > server side execution of the (JSP-generated) servlet.
              >
              > The normal way for the servlet generated from the JSP to behave is
              > that the output stream to the browser is buffered - that is, as the
              > servlet generates output it is written to the buffer in chunks and the
              > buffer is written to the browser in chunks. On all but the shortest
              > pages the content from the bottom of the JSP hasn't even been
              > generated yet at the time the buffer starts writing to the browser.
              >
              > I want to turn this behavior off. I want no output sent to the browser
              > until the whole output is generated. This way I can put timers in my
              > client side Javascript and know they are measuring only the client
              > side execution time, not the server side.
              >
              > Does anyone know how to do this?
              >
              > Eliot Stock
              > Premiere Retail Networks
              > San Francisco
              ============================
              [email protected]
              

  • Output HTML to proper page

    I call a servlet from a second window(thirdWin) that was created/opened by the first window(window) in HTML. The servlet writes out HTML to the browser using the following code(note HTML$ is a java class that contains methods of HTML code lines):
    PrintWriter out=response.getWriter();
            HTML$.pageBegin();
            HTML$.tableHeader("Murph");The problem is that the servlet writes/ outputs the HTML code to the third window(thirdWin). I want to call the servlet from the third window and write/output the new HTML to the first window. There must be a way of accomplishing this. One, by setting the browser window directory to the original window(first window) before the servlet is called so that the new HTML gets written to that page, or two, by setting the brower window to the proper window in the servlet before writing the HTML out to the window.
    The following is the code in the servlet that opens the thirdWin. It is a javascript function whose body is a Servlet that has been written it out to the browser page. Do not get confused with me calling it the thirdWin it is acually a second window opened by the opener, I have just called it thirdWin.
    out.println("thirdWin = open('', 'UserName', 'height=300, width=500 scrollbars=yes');");
          out.println("thirdWin.document.write(\"<TITLE>Enter UserName</TITLE>\");");
             out.println("thirdWin.document.write(\"<BODY BGCOLOR=white>\");");
             out.println("thirdWin.document.write(\"<FORM name='showEdit' method='post' action='showEditProfile'>\");");
             out.println("thirdWin.document.write(\"<table><tr><td width=120>User Name :</td><td width=300><input type='text' class='listRow' name='user_name'></td></tr></table>\");");
             out.println("thirdWin.document.write(\"<table><tr><td width=120>Password :</td><td width=300><input type='text' class='listRow' name='user_name'></td></tr></table>\");");
             out.println("thirdWin.document.write(\"<table><tr><td width=120>Search :</td><td width=300><input type='submit' name='showEdit' value='Show Profile'/></td></tr></table>\");");
            /**out.println("thirdWin.document.write(\"<table><input id =\"subfds\" type=\"button\" name=\"Submit5\" value=\"Enter Information\" onclick=\"\"/></table>\");");**/
             out.println("thirdWin.document.write(\"</FORM>\");");
             out.println("thirdWin.document.write(\"</BODY>\");");
             out.println("thirdWin.document.write(\"</HTML>\");");
          out.println("thirdWin.document.close()");

    I have a database, it holds information of a user, my applet interacts with the database to retrieve/write etc. What i want to do is when some1 clicks a button to open a new Internet Explorer page and then output a record from the database. Just like System.out.println(forname + surname + date + score);
    I dont know how to open a new IE and then output the info to it.
    I dont have any code for this part as I havent written it and I dont think there is any value in posting code to retrieve from database. We can just treat them as strings? String forname, surname etc.

  • Pass query to servlet through midlet

    Hi, I have a problem here. I would like to control the SQL Statement to be executed by the servlet using the mobile midlet. Like this one:
    midlet -> will call servlet with parameter statement -> servlet will execute the statement parameter passed by the midlet and will return a data result in XML -> midlet will read the XML file and retrieve the data.
    Another thing I would like to ask is how will I make the servlet to output an XML file that can be read by the midlet. If there's some tutorial on how please give me the link.
    I hope you get my point.

    I have made to retrieve data on my midlet from my servlet. The bad thing is the data sent on the midlet has html tags. How will I make the midlet to just output the data result without the tags?If you are in charge of the servlet, then have it output plain text. If you need to parse the MIDlet input first, then having the content of XML/HTML elements will allow you to print them out.
    Is this servlet used from HTML browser as well? If so, try having a separate one for mobile devices. There are plenty options to do it.
    Daniel

  • Using existing java servlet as web portlet?

    I have an existing java servlet that I am trying to use as a web portlet. When I log into portal and run the page I have placed my web portlet on, the header shows up, but not the data.
    I don't fully understand the provider.xml file (especially the renderer part), so my provider.xml file could be wrong:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?providerDefinition version="2.0"?>
    <provider class="oracle.portal.provider.v1.http.DefaultProvider">
    <session>true</session>
    <portlet class="oracle.portal.provider.v1.http.DefaultPortlet" version="1">
    <id>1</id>
    <name>XSLSample</name>
    <title>XSL-XML Conversion</title>
    <description>performs xml conversion</description>
    <timeout>100</timeout>
    <timeoutMessage>Portlet timed out</timeoutMessage>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v1.RenderManager">
    <showPage class="oracle.portal.provider.v1.http.Servlet20Renderer">
    <servletClass>XSLSample</servletClass>
    </showPage>
    </renderer>
    </portlet>
    </provider>
    This is my servlet code:
    import org.w3c.dom.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import oracle.xml.parser.v2.*;
    * This file gives a simple example of how to use the XSL processing
    * capabilities of the Oracle XML Parser V2.0. An input XML document is
    * transformed using a given input stylesheet
    public class XSLSample extends HttpServlet
    * Transforms an xml document using a stylesheet
    * @param args input xml and xml documents
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    doGet(request, response);
    public void doGet (HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL xslURL;
    URL xmlURL;
    try
    // Parse xsl and xml documents
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    // parser input XSL file
    xslURL = createURL("e:/testxsl.xsl");
    parser.parse(xslURL);
    xsldoc = parser.getDocument();
    // parser input XML file
    xmlURL = createURL("e:/testxml.xml");
    parser.parse(xmlURL);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, xslURL);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    processor.setErrorStream(System.err);
    // Process XSL
    DocumentFragment result = processor.processXSL(xsl, xml);
    // create an output document to hold the result
    out = new XMLDocument();
    // create a dummy document element for the output document
    Element root = out.createElement("root");
    out.appendChild(root);
    // append the transformed tree to the dummy document element
    root.appendChild(result);
    // print the transformed document
    out.print(response.getOutputStream());
    catch (Exception e)
    e.printStackTrace();
    } //END OF DOGET
    // Helper method to create a URL from a file name
    static URL createURL(String fileName)
    URL url = null;
    try
    url = new URL(fileName);
    catch (MalformedURLException ex)
    File f = new File(fileName);
    try
    String path = f.getAbsolutePath();
    // This is a bunch of weird code that is required to
    // make a valid URL on the Windows platform, due
    // to inconsistencies in what getAbsolutePath returns.
    String fs = System.getProperty("file.separator");
    if (fs.length() == 1)
    char sep = fs.charAt(0);
    if (sep != '/')
    path = path.replace(sep, '/');
    if (path.charAt(0) != '/')
    path = '/' + path;
    path = "file://" + path;
    url = new URL(path);
    catch (MalformedURLException e)
    System.out.println("Cannot create url for: " + fileName);
    System.exit(0);
    return url;
    I had to add a "doPost" to my servlet because I was getting the jserv error "Post is not supported by this URL", but that is the only thing I have changed. Do I have to use some of the "portlet" classes in my servlet? (The servlet works fine standalone in ie, just won't output anything on my portal page.)
    Any ideas will be appreciated.

    The problem is in the following line:
    out.print(response.getOutputStream());
    Portlets (unlike servlets) cannot output to a n OutputStream, but only to a PrintWriter.
    I had a similiar problem trying to output a chart. My solution was to output the chart to a file, then reference the chart by outputting a HTML img tag from the portlet, which referred to the file in the src attribute.
    null

  • Screens in HTML +Servlets

    Hi ,i am writing my screens in HTML but form the out.println also ,and my textfields will not line up ,i was wondering if any of know why this is ,and is there a differnt way of doing so ?
    heres what i have,and all the spaces are equal size but yet are not lined up?
    out.println("<param name=\"lastName\" value=\"\" />");
    out.println("<p align=\"center\">* Last Name:     <input type=\"text\" name=\"lastName\" size=\"30\" value=\"\">");

    hi, i just wanted to point out that your problem is HTML specific, (not java)
    so you would have more luck with it if you'd go to some HTML forum or something...
    once you've figured out exactly what kind of text your servlet should output, so taht it would line up correctly in browser, then you might want to check here for some servlet specific questions (if by that time you havent solved these yourself)
    good luck

Maybe you are looking for