Output of JSP

Hi
How can u make a JSP output while its doing its processing and not ouput after its done all its processing.
For example, a jsp reads/accesses a db. The JSP contains a for loop which ouputs data. A statement in the for loop makes a table row. I want the jsp to output (or create and display) each row instead of ouputing the whole table once the for loop has finished.
Can any1 pls help.
Thanx.

i give u a sample:
<%
while(!rs.eof())
rs.getString(0);//get the first row
rs.getString("age");//get the "age" row
rs.next();
%>
maybe it will be useful to you!

Similar Messages

  • I want to translate output of JSP from English to HINDI and other language.

    hi frens !!
    i want to translate output of JSP from english to HIndi and other languages.I need the class which could traslate the Output in other languages.
    Thanks and Regards
    Allwyn

    hi frens !!
    i want to translate output of JSP from english to
    HIndi and other languages.I need the class which
    could traslate the Output in other languages.
    Thanks and Regards
    Allwynit looks like your translator is not working correctly. read up on internationalization.

  • System.out from Java class not output to JSP

    I am using JSP to make a Java API web accessible. I include (package) java classes that write error messages to standard out when they catch an error. Works fine on the command line. Problem occurs when using in JSP. I include them with a page directive (importing the package) rather than use them as beans, since they do so much more than beans do, and since I use many of the classes in a single page.
    i.e.
    <%@ page import="OPS.*" %>
    When errors occur, messages to "standard out" (system.out) don't appear in the html output of the JSP. I don't know where they are going (they aren't in the web server's error log), but they aren't going where I expected them to (browser window).
    I figured that standard out was the browser (httpServletResponse). Where am I going wrong here?
    Basically, I have a class that connects to a database (call it db) and does queries/updates. I have a class (call it employee) that uses the db class. I have a jsp page that instantiates the employee class and executes method calls. The code in the db class that outputs SQL error messages (db class instantiated by employee class) never gets put in the browser window. Nor in the server log, nor the console.
    How can I get system.out calls in classes db and employee to get output to the browser? The JSP outputs all other code and is not freezing nor not flushing the buffer.
    Thanks!

    I also use an Iplanet over which I have little control. But I can log on via telnet. If I log on (I use Reflection) and run my pages, the errors show in the Reflection window. If you have telnet access to the server, you might want to give this a try.
    Another alternative would be to add a few lines to your classes that allow you to pass a reference to the jsp StringWriter from your jsp and use that to output the errors to the browser.

  • Capture output myPage.jsp and send by email

    Hi all,
    I'm trying to capture HTML output produced by myFirstPage.jsp and then send it by java mail.
    The first problem is : How can I capture the output?
    Is right to call myFirstPage.jsp from another jsp page (by use HttpURLConnection) and then write a myOutput.hml file?
    Moreover,the second problem is : How can I send Html file with all images incluted?
    I read about use CID, but how can I read dynamically Images from HTML file and replace the Path with a CID Reference and then put all HTML file in messageBodyPart ??
    Thanks in advances
    Francesco.

    The first problem is : How can I capture the output?
    Is right to call myFirstPage.jsp from another jsp page (by use HttpURLConnection) and then write a myOutput.hml file?That would work.
    But there is a better way.
    You can use a javax.activation.URLDataSource for your Email.
    DataSource mailContent = new URLDataSource("http://localhost/myFirstPage.jsp");
    That will connect to the URL, and use the result as the body of the message.
    Sorry, don't know about including the images as well.
    Cheers,
    evnafets

  • Capturing the output from jsp selvlet

              Hi,
              I have a requirement where I need to capture the output of the JSP generated servlet
              , and do something with it before it get's to the client side.
              Has someone done something like this before.Any ideas, suggestions .
              Thanx,
              Tajdar
              

    You can set the MIME content type as .doc and try to open the Page.
    res.setContentType("application/vnd.ms-excel"); to generate the Page output as Excel
    res.setContentType("application/vnd.ms-word"); to generate the Page output as MS Word doc
    Hope this helps..

  • Is the raw output from JSP and XSQLServlet the same?

    Hi
    Is there is difference between the raw output from XSQLServlet and JSP? For example, assuming the same content is being generated, is there some additional header information emitted by XSQLServlet that is not done by JSP?
    I am using software that successfully consumes generated content from a JSP OK, but the same content (using the same XML/XSL) generated from XSQLServlet is being rejected. I am puzzled by this. Maybe this is due to some differences in servlet output or an encoding issue? The content is not HTML but XML-like with an "application" contentType, like Steve's SVG example.
    It seems that XSQLServlet is showing some data prior to emitting the actual content, i.e. HTTP version, responding server version, content type and date, e.g.
    HTTP/1.0 200 OK^M
    Server: Resin/2.0.5^M
    Content-type: application/x-sky; charset=UTF-8^M
    Date: Thu, 28 Mar 2002 06:45:34 GMT^M
    ^M
    (then the generated content)
    Is this preamble usually generated by a JSP also?
    If not, can this information be turned off, or put another way, can XSQLServlet's raw output be set to be exactly like JSP? If not, is there a workaround?
    I have tried setting the following XSQLConfig.xml
    <suppress-mime-charset> for the mime-type &
    <character-set-conversion>
    <none/>
    </character-set-conversion>
    also, but to no avail.
    Please help! I really want to use XSQLServlet!
    Thanks.
    Michael.

    Yes, just less fine control over the process but the same engine.
    Regards
    TD

  • Doubled output from JSP

              This is odd ! We are using WLS 6.1 with servlets and JSPs, no EJB. Sometimes
              we use System.out.println() for debugging in a JSP and once in a while we see
              the debug message being output twice. We have a proxy server for our intranet
              and when we disable that from the browser (IE 5.5) the double output goes away.
              What is puzzling abou this is that the double output alos goes away if we run
              the same JSP in Tomcat ... regardless of whether or not we enable the proxy server
              in our browsers !
              Any ideas or similar experiences ?
              TIA !!
              eja
              

    sorry guys,
    I asked a stupid question. realised it almost as soon as I posted it.
    Ta,
    R

  • Extraneous new lines in HTML output of JSP page

    Hi
    I have bunch of JSP fragments that I use while creating a composite view..Each one of them has server side comments that I use to document their functionality...
    However when final JSP is generated and when I look at the HTML source (which I often need to) it is "chunked" - there is a about 50 blank lines inserted at the top of the page and then on each fragment about 10 or more blank lines.... Initially, I thought that the server side comments created new lines but after removing the comments and redeploying the problem still persists......
    Is there a way to prevent these new lines from being generated? Especially the ones at the start of the document....
    Thanks

    That is not the only way. In your server's default web.xml, there should be a servlet definition for JSPs, something like this:
        <servlet>
            <servlet-name>jsp</servlet-name>
            <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
            <init-param>
                <param-name>fork</param-name>
                <param-value>false</param-value>
            </init-param>
            <load-on-startup>3</load-on-startup>
        </servlet>There is a possible init-param called trimSpaces which will do the job:
            <init-param>
                <param-name>trimSpaces</param-name>
                <param-value>true</param-value>
            </init-param>This may be only a Tomcat 5 feature, however.

  • Parse XML and Output to JSP page

    I have a number of XML documents which are all formatted in the same way, just with different information in the fields.
    I wish to parse the XML documents using DOM and output them to an XML page.
    How would i go about doing this?
    If you could write a small example or any websites that you think might help.
    Thanks.

    I have the parsing working but i cant seem to figure out how to get information out of the parsed document and into variables.
    This is a sample of my XML file
    <?xml version="1.0"?>
    <product code="QB-1226-AB">
         <productName>Professional Floodlights</productName>
         <description>PIR floodlights that are designed for professional installation. A faulty light requiring a return visit will cost far more than a quality light does in the first place. 3 year guarantee.</description>
         <price>120</price>
         <manufacturer>Black and Decker</manufacturer>
    </product>I can get the productCode value out without any problems using
    String name = attrs.getValue("code");
    But if i try the same for any of the others i get null. I can accomplish this using DOM easily but i cant find anything at all about getting values out of it using SAX.
    Any help would be greatly appreciated.

  • Redirecting the servlet output to jsp

    Hi i need to redirect my servlet out put to jsp
    in result set's every row i have 9 columns
    this result set how can i redirct to jsp
    plz can any one let me know with an example
    thanks a lot in advance

    inamdar wrote:
    Hi i have never used DTO's and DAO classes
    plz colud u let me know without using that..Huh? It is never too late to start with it. Just create two simple classes. A DTO class is basically a simple javabean with private (encapsulated) properties and a public getter and setter for each property. A DAO class is basically a class which contains purely JDBC code.
    Sample DTO:public class MyData {
        private Long id;
        private String name;
        private Integer value;
        public Long getId() { return id; }
        public String getName() { return name; }
        public Integer getValue() { return value; }
        public void setId(Long id) { this.id = id; }
        public void setName(String name) { this.name = name; }
        public void setValue(Integer value) { this.value = value; }
    }Sample DAO:public class MyDataDAO {
        public List<MyData> listAll() {
            String listAllQuery = "SELECT id, name, value FROM data";
            List<MyData> myDataList = new ArrayList<MyData>();
            Connection connection = null;
            Statement statement = null;
            ResultSet resultSet = null;
            try {
                connection = getConnectionSomehow(); // DriverManager or Connection Pool, your choice.
                statement = connection.createStatement();
                resultSet = statement.executeQuery(listAllQuery);
                while(resultSet.next()) {
                    MyData myData = new MyData();
                    myData.setId(new Long(resultSet.getLong("id")));
                    myData.setName(resultSet.getString("name"));
                    myData.setValue(new Integer(resultSet.getInt("value")));
                    myDataList.add(myData);
            } catch (SQLException e) {
                // Handle it. Print it, throw it, log it, mail it, your choice.
                e.printStackTrace();
            } finally {
                // You can write an utility class/method for those lines as well.
                if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { e.printStackTrace(); } }
                if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } }
                if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } }
            return myDataList;
    }Sample Servlet code:List<MyData> myDataList = new MyDataDAO().listAll();
    request.setAttribute("myDataList", myDataList);
    request.getRequestDispatcher("someJspFile.jsp").forward(request, response);Sample JSTL code in someJspFile.jsp:<table>
        <c:forEach items="${myDataList}" var="myData">
            <tr>
                <td>${myData.id}</td>
                <td>${myData.name}</td>
                <td>${myData.value}</td>
            </tr>
        </c:forEach>
    </table>Simple and clean, isn't it?

  • WML Output From JSP/Servlets

    I need some assistance with WML output from someone who knows...
    I am writing a small subset of applications for mobile access. When testing them through the OpenWave Emulator (the UP browser) everything works just fine. However..the output varies greatly to where on some machines the login cannot be performed. My only problems tend to occur with forms and the lack of an <input type="submit"/> component.
    Here's the WML output of the login screen:
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
    "http://www.wapforum.org/DTD/wml12.dtd">
    <wml>
    <card id="login" title="Login Form">
    <p>Please login.<br/>
    <table>
    <tr><td>Username:</td></tr>
    <tr><td><input name="username" type="text" title="username"/></td></tr>
    <tr><td>Password:</td></tr>
    <tr><td><input name="password" type="password" title="password"/></td></tr>
    </table>
    </p>
    <do type="accept" label="Login">
    <go href="/portal/mobile/vendor/" method="POST">
    <postfield name="username" value="$(username)"/>
    <postfield name="password" value="$(password)"/>
    </go>
    </do>
    </card>
    </wml>Again, in OpenWave's UP browser, I can enter the username and password, then click options --> Login and things work great.
    However on the WinWap browser, I only get the labels, no input fields or login option.
    Does this WML look properly formed? Any help would be appreciated.

    I can't really tell you the fix, as I really can't remember, but I know I had a similar problem once... OpenWave was fine, but the Nokia emulator didn't like it.
    I think I ended up having a different DOCTYPE and having the username and password inputs on separate pages.
    Does WML support tables?

  • Output from JSP to console

    Hi,
    I am basically trying to handle any exception thrown in my application. My error.jsp works fine except for the fact that I want to print the stack trace in the system console.
    Can anyone pls help?
    Thanks in advance.
    Ron

    sorry guys,
    I asked a stupid question. realised it almost as soon as I posted it.
    Ta,
    R

  • Displaying output to jsp

    I am trying to display userList from my struts action to jsp page,what's the code to do it using java beans or something simple?
    part code:
    action class
    public ArrayList userList = new ArrayList();
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
    //get connection from database
    javax.sql.DataSource dataSource;
    java.sql.Connection myConnection = null;
    // Here the method that connects to the datasource is called:
    dataSource = getDataSource(request);
    myConnection = dataSource.getConnection();
    UserDAO dao = DAOFactory.createUserDAO(myConnection);
    userList = dao.getUser();
    HttpSession session = request.getSession();
    // extract data
    if(userList !=null){
    return mapping.findForward("success");
    }else{
    return mapping.findForward("fail");
    }

    Check java.lang.Runtime API.

  • Help on jsp:output

    I am trying to use the <jsp:output> tag within jdeveloper10.1.2, but it is not included within the tags for JSP in the component pallete, so I keep getting an error. Any idea, pls ?

    jsp:output is a J2EE 1.4 JSP 2.0 tag.
    JDeveloper 10.1.2 provides only the JSP 1.2 tags.
    http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html
    JDeveloper 10.1.3 supports J2EE 1.4 (JSP 2.0).
    Some of the JSP 2.0 tags are not in the Component Palette.
    jsp:output tag, jsp:invoke and jsp:text tags which are jsp 2.0 tags are not in the Component Palette.
    http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html

  • Accessing session attribute in output jsp page

    Hi i am not getting any output in jsp page...
    i am getting just heading
    i think some problem with Session attribute..
    if so how to access session been in jsp page
    my code is here
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Tauvex Search Output</title>
    </head>
    <body>
    Tauvex Search Output
    <table>
    <c:forEach items="${myDataList}" var="myData">
    <tr>
    <td>${myData.Fitsfilename}</td>
    <td>${myData.RA_START}</td>
    <td>${myData.RA_END}</td>
    <td>${myData.DEC_START}</td>
    <td>${myData.DEC_END}</td>
    <td>${myData.telescope}</td>
    <td>${myData.STARTOBS}</td>
    <td>${myData.ENDOBS}</td>
    <td>${myData.FILTER}</td>
    </tr>
    </c:forEach>
    </table>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>
    plz reply soon
    thanks a lot

    this is what i set in servlet
    request.setAttribute("myDataList", myDataList);
    request.getRequestDispatcher("someJspFile.jsp").forward(request, response);
    how can i access that session attribute in jsp

Maybe you are looking for

  • Acrobat Catalog in 9 Pro Extended?

    I am currently using Acrobat 6.05. I use the Acrobat Catalog application built into Acrobat extensively, creating many large indexes of searchable pdf documents. I am unable to determine whether the Catalog application is available in the newest vers

  • File(S) to IDOC

    Our Scenario is receiving data from multiple files into XI and post that as an IDOC.(File(s) to XI to R/3 (IDOC). The records in files are grouped based on the condition and then sent to the R/3 for posting as an idoc. Could some one explain me what

  • Sync just podcasts across two computers

    I have a new netbook. My desktop has iTunes. I have a lot of podcasts on there and I listen to them often through my iPod and sometimes through the desktop. All is well with syncing, I just delete listened to podcasts here and there on the pc and it

  • Re: long subject in sending email

    Hi, i am sending a email on customer statement.Now my problem is the subject length exceed thd standard length.Please check my code. Data:w_doc_data    TYPE sodocchgi1   w_doc_data-obj_langu  = sy-langu.   w_doc_data-obj_name   = 'SAPRPT'.   w_doc_da

  • Desktop Manager Question

    Hello, i am using a 8700g currently which is running off of v4.1.0.346 (platform 2.0.0.143), with T-Mobile. I purchased a new Bold online with AT&T due to bad reception at my home and i really liked the Bold. My question is this: Which version of des