Out.println in jsp?

Can out.println be used in JSP? I got the following error:
I have googled that out.println cannot be used in a method declaration, which is what i've done. So what do i do from there?
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:39: cannot find symbol
symbol  : variable out
location: class org.apache.jsp.menu_005ftest_jsp
                        out.println("<li><a href=" + strMenuLink + ">" + strMenuName + "</a>");
                        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:40: cannot find symbol
symbol  : variable out
location: class org.apache.jsp.menu_005ftest_jsp
                        out.println("<ul>");
                        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:42: cannot find symbol
symbol  : variable out
location: class org.apache.jsp.menu_005ftest_jsp
                        out.println("</ul>");
                        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:44: cannot find symbol
symbol  : variable out
location: class org.apache.jsp.menu_005ftest_jsp
                        out.println("<li><a href=" + strMenuLink + ">" + strMenuName + "</a></li>");
                        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:113: out is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
                    PrintWriter out = response.getWriter();
                                ^
5 errors
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\nbproject\build-impl.xml:364: The following error occurred while executing this line:
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\nbproject\build-impl.xml:149: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)At first i didnt declare a PrintWriter but then after i first got the error, i just threw it in. But it seems that even that part has an error too. Thanks.

Thanks! I actually thought that it was not a good idea to use it because the method i created can calls itself and it is very confusing to me. So i switched back to using normal codes html. (is it called template code?) Anyway this is a new problem that i face, should i start a new thread since its a different issue?
The new error, could it be due to the two different try and catch? (see code below)
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:40: illegal start of expression
  private static java.util.List _jspx_dependants;
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:27: 'try' without 'catch' or 'finally'
            try{
            ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:123: 'catch' without 'try'
                        } catch (SQLException ex) {
                          ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:60: 'try' without 'catch' or 'finally'
    try {
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:152: 'else' without 'if'
                    } else {
                      ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:156: class or interface expected
        }catch (SQLException e){
        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:158: class or interface expected
        }finally{
        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:160: class or interface expected
        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:162: class or interface expected
        ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:165: class or interface expected
      out.write("    </body>\n");
      ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:166: class or interface expected
      out.write("</html>");
      ^
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:167: class or interface expected
    } catch (Throwable t) {
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:170: class or interface expected
        if (out != null && out.getBufferSize() != 0)
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:172: class or interface expected
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:173: class or interface expected
C:\Documents and Settings\USER\Desktop\FOS_Menu\FOS_Menu\build\generated\src\org\apache\jsp\menu_005ftest_jsp.java:176: class or interface expected
16 errorsAnd the code for your reference:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="FOS.dbconnection.*, FOS.User.*, FOS.Menu.*, javax.servlet.http.*, javax.servlet.jsp.*,javax.servlet.*,
java.sql.*,java.awt.*,java.net.*,java.io.*;"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-AU">
    <head>
        <title>FOS Menu</title>
        <script type="text/javascript" src="mb.js"></script>
        <link rel="stylesheet" href="mb.css" />
    </head>
    <body onload="mbSet('mb2', 'mbh');">
        <div id="c">
            <div id="eg">
                <ul id="mb2">
                    <%
                    Connection conn = null;
                    Statement stmt;
                    ResultSet rs;
                    String sqlStr;
                    conn = DBConnection.getConnection();
                    try {
                        sqlStr = "SELECT menu_id, menu_name FROM application_mstr WHERE menu_type ='P' AND parent_id='N' ORDER BY module_seq";
                        stmt = conn.createStatement();
                        rs = stmt.executeQuery(sqlStr);
                        while (rs.next()) {
                            String strParentMenuId = rs.getString("menu_id");
                            String strParentMenuName = rs.getString("menu_name");
                    %>
                    <li><a href=""><%= strParentMenuName %></a>
                        <ul>
                            <%
                            getChildren(strParentMenuId);
                            %>
                        </ul>
                    </li>
                    %>                   
                </ul>
            </div>
        </div>
        <%
                        } catch (SQLException ex) {
                            out.println("<P>" + "Error:");
                            out.println("<PRE>" + ex + "</PRE> \n <P>");
                        } catch (Exception e) {
                            out.println("<P>" + "Error:");
                            out.println("<PRE>" + e + "</PRE> \n <P>");
                        } finally {
                            DBConnection.closeConnection(conn);
        %>
        <%!
        String getChildren(String strMenu_id){
            Connection conn = null;
            PreparedStatement pstmt;
            ResultSet prs;
            String sqlStr;
            try{
                sqlStr = "SELECT menu_id, menu_name, menu_link FROM application_mstr WHERE parent_id=? ORDER BY menu_seq";
                pstmt = DBConnection.getPreparedStatement(conn, sqlStr);
                pstmt.setString(1, strMenu_id);
                prs = pstmt.executeQuery();
                while (prs.next()){
                    String strMenuId = prs.getString("menu_id");
                    String strMenuName = prs.getString("menu_name");
                    String strMenuType = prs.getString("menu_type");
                    String strMenuLink = prs.getString("menu_link");
                    if (strMenuType == "P"){                       
        %>
        <li><a href='<%=strMenuLink %>'> <%=strMenuName %></a>
        <ul>
            <%
            getChildren(strMenuId);
            %>
        </ul>
        <%
                    } else {
                        out.println("<li><a href=" + strMenuLink + ">" + strMenuName + "</a></li>");
        }catch (SQLException e){
            System.err.println("Error executing stmt :" + e);
        }finally{
            DBConnection.closeConnection(conn);
        return "";
        %>
    </body>
</html>

Similar Messages

  • How to put tab for alignment using out.println?

    can anyone tell me how to put something like \t in out.println of JSP/

    out.println("<blockquote>your text</blockquote>");

  • Difference between system.out.println() & out.println()

    Could anybody please tell what is the difference between System.out.println() & out.println() in JSP ? I have noticed sometimes times the former works & sometimes latter. But I don't know where to use what & the difference between the two.

    System.out is the console (or log file potentially)
    In JSPs, out is defined for you as the stream send back to the browser. e.g. the HTML the browser displays.
    System.out always works, but you might not see the output.
    out only works is a variable has been defined like; PrintStream out.

  • Out.println() problems with large amount of data in jsp page

    I have this kind of code in my jsp page:
    out.clearBuffer();
    out.println(myText); // size of myText is about 300 kbThe problem is that I manage to print the whole text only sometimes. Very often happens such that the receiving page gets only the first 40 kb and then the printing stops.
    I have made such tests that I split the myText to smaller parts and out.print() them one by one:
    Vector texts = splitTextToSmallerParts(myText);
    for(int i = 0; i < texts.size(); i++) {
      out.print(text.get(i));
      out.flush();
    }This produces the same kind of result. Sometimes all parts are printed but mostly only the first parts.
    I have tried to increase the buffer size but neither that makes the printing reliable. Also I have tried with autoFlush="false" so that I flush before the buffer size gets overflowed; again same result, sometimes works sometimes don't.
    Originally I use such a system where Visual Basic in Excel calls a jsp page. However, I don't think that this matters since the same problems occur if I use a browser.
    If anyone knows something about problems with large jsp pages, I would appreciate that.

    Well, there are many ways you could do this, but it depends on what you are looking for.
    For instance, generating an Excel Spreadsheet could be quite easy:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TableTest extends HttpServlet{
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
              response.setContentType("application/xls");
              PrintWriter out = new PrintWriter(response.getOutputStream());
                    out.println("Col1\tCol2\tCol3\tCol4");
                    out.println("1\t2\t3\t4");
                    out.println("3\t1\t5\t7");
                    out.println("2\t9\t3\t3");
              out.flush();
              out.close();
    }Just try this simple code, it works just fine... I used the same approach to generate a report of 30000 rows and 40 cols (more or less 5MB), so it should do the job for you.
    Regards

  • In a JSP having a problem using out.println in method

    I am trying to update a field on a form using JAVASCRIPT generated by JSP. The following code works fine when in the main body of the code.
    The field tota on form mainform is updated based on the contents of strTest.
    out.println("<SCRIPT LANGUAGE='JavaScript'>")
    out.println("document.mainform.tota.value = " + strTest);
    out.println("document.mainform.tota.focus()");
    out.println("</SCRIPT>");
    But if you have 10 flds that you want updated, it would be nice NOT to have to use 40 lines of code to do it. I am trying to build a method that will accept a field name and some data to put in a form field. I started small and just wanted to update 1 fld using the method below:
    <%!
    //Declare method to update form fields
    void Update_Frm_Fld()
    out.println("<SCRIPT LANGUAGE='JavaScript'>")
    out.println("document.mainform.tota.value = " + strTest);
    out.println("document.mainform.tota.focus()");
    out.println("</SCRIPT>");
    %>
    I keep getting the error:
    Time_Entry_jsp.java:21: cannot resolve symbol
    symbol : variable out
    location: class org.apache.jsp.Time_Entry_jsp
    out.println("");
    ^
    Help.....

    try this:
    <%@ page import="java.io.*" %>
    <%!
    //Declare method to update form fields
    public void Update_Frm_Fld(HttpServletResponse response)
         throws ServletException, IOException{
              PrintWriter out=response.getWriter();
              out.println("<SCRIPT LANGUAGE='JavaScript'>");
              out.println("document.mainform.tota.value = "+1);
              out.println("document.mainform.tota.focus()");
              out.println("</SCRIPT>");
    %>and when you call the function use this:
    <%Update(response);%>

  • Syntax to pass parameter value to jsp using href in out.println

    Hi,
    I have the URL in the form as mentioned below:
    <a href="b2c/marketing/showDocDetail.jsp"> <%=doc_no%></a>
    I've created the hyperlink using href tag to the document number in the jsp using the below syntax.
    <% String a1 = "Document ";
           String a2 = "<a href=\"";
           String a3 = "marketing/showDocDetail.jsp\">";
           String a4 = doc_no;
           String a5 = "</a>";
    out.println(a1a2a3a4a5);
    %>
    When clicked the doc_no is passed to backend RFC and export parameter is retrieved to result.jsp where values along with doc_no are displayed.
    the value after clicked is not being passed to action.java class that does the retreival.
    Needful, backend class, bom, entry in config.xml is all maintained.
    Please help me out with the syntax to pass the parameter value into java class

    Hi Bharathi,
    try below.
    <%
           String a1 = "Document ";
           String a2 = "<a href=\"";
           String a3 = "marketing/showDocDetail.do?docNo=";
           String a4 = doc_no;
           String a5 = " \">";
           String a6 = doc_no;
           String a7 = "</a>";
    out.println(a1+a2+a3+a4+a5+a6+a7);
    %>
    I assume doc_no is java variable contains value of document number
    Now create action entry in config.xml file. Suppose "actionDoc.java" class process it.
    <action path="/marketing/showDocDetail" type="com.xyz.actions.actionDoc">
                   <forward name="success" path="/marketing/showDocDetail.jsp"/>
                   <forward name="error" path="/marketing/showDocDetail.jsp"/>
    </action>
    We are passing parameter docNo=doc_no to action class actionDoc.java in this class you can retrieve request parameter docNo from request object and then process it as you want.
    Let me know if you face any problem or error.
    eCommerce Developer
    Edited by: Ecommerce Developer on Nov 9, 2009 8:35 AM

  • Calling out.println in a jsp function

    Hi, i want to call out.println in a jsp function. That is i am using function like this
    <%!
    void MyFunction()
    out.println("this is good");
    %>
    This code fails with error message: "out cannot be resolved"
    Also i don't want to return value from the function, since i will later call this function recursive and display value at each instant.
    Please suggest any solution.

    <%!
    void MyFunction(JSPWriter out)
    out.println("this is good");
    %>and then execute it with:
    <% MyFunction(out): %>

  • System.out.println in Servlets/JSPs

    Hi,
    Which file and directory in JDeveloper 10g (10.1.3.0) on windows does the output of System.out.println get logged to? THanks in advance.
    regards,

    Goes to standard out, not a file. So if you're running the embedded server you will see it in your Embedded Server Console window. However, you should never be using system.out.println in a servlet/jsp. Instead use commons logging or log4j to get log messages.

  • How can I show a System.out.println(""); into a JSP?

    Is a simple doubt that would help me a lot to reach other thing that I wished reach with a JSP.
    Thank you!!!

    Hi!!!
    Thank you to answer me......my question�is because�my problem is a little more complicated��let me tell you�.
    My problem is that I wish to do some queries to a table of a Municipalities DB, I have read about that....and according with the exemples....my JSP...should be running and executing very well....but I haven�t had success with that...:(
    My JSP file is:
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    catch (Exception e) {
    e.printStackTrace();
    Statement stmt = conn.createStatement();
    stmt.execute("select * from cat_municipio");
    ResultSet rs = stmt.getResultSet();
    while (rs.next()) {
    System.out.println(rs.getInt("cve_municipio") + " - " + rs.getInt("cve_sepomex") + " - " + rs.getString("desc_municipio"));
    stmt.close();
    conn.close();
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>
    My result obtained is the following:
    Municipalities List
    Please call Mary with any updates ASAP!
    Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    I don�t obtain nothing.....is like DB table were without information......but in reality the DB table has information.....and I can obtain it with the following JSP:
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    // Fetch all records from the database in a TableDataSet
    DataSet dSet = new TableDataSet(conn, "cat_municipio").fetchRecords();
    TableElement tE = new TableElement(dSet);
    tE.setBorder(1);
    out.print(tE);
    } catch (SQLException sqle) {
    out.print("Sorry, the database is not available.");
    out.print("Exception: " + sqle);
    } catch (Exception e) {
    out.print("Exception occured: " + e);
    } finally {
    if(conn != null)
    try {
    conn.close();
    } catch(SQLException sqle) {}
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>
    and with this JSP I obtain all the following information:
    Municipalities List
    CVE_MUNICIPIO CVE_SEPOMEX DESC_MUNICIPIO
    1 1 ACAJETE
    2 2 ACATENO
    3 3 ACATLAN
    4 4 ACATZINGO
    5 5 ACTEOPAN
    Now...I need that the first JSP work very well, because...with that way...I can do queries and obtain the needed results for showing them in the Browser......
    So, I already find out�.that�any string that I send to the browser with System.out.println(); isn�t showed�.so it is the reason of my question�..how I can see my results of a query using a loop (like a for, while) resolving it....I think my problem would be resolved.
    So...I hope you understand me, and you could help me please...thanks.....
    Mary
    P.D. I also attempted with the following JSP...but the result is the same....I don�t obtain none result...
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    catch (Exception e) {
    e.printStackTrace();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select CVE_MUNICIPIO, CVE_SEPOMEX, DESC_MUNICIPIO from cat_municipio");
    while (rs.next()) {
    System.out.println(rs.getInt(1) + " - " + rs.getInt(2) + " - " + rs.getString(3));
    rs.close();
    stmt.close();
    conn.close();
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>

  • How to dynamically generate HTML in Servlet without all the out.println?

    Since I am not sure whether this is a Java Servlet or JSP problem, so I will describe my situation. And hopefully someone can propose a good solution. I came from a PHP, so Java Servlet and JSP are still a little bit foreign for me.
    My problem
    My front end is a JSP page that essentially contains a form (let’s call it form1). The reason it is a JSP not a HTML is because I will need to load form data from the backend and display them in the form. Once the user submits the form, it will go to a backend Java Servlet (let’s call it servlet 1), which loads data from files according to user input. Then, I will need to dynamically create a new form (let’s call it form2) based on the data loaded from files. Once the user inputs and submits form2, another Java Servlet (servlet 2) will do more processing. That is the end of line. Both form1 and form2 require Javascript.
    My question is that since servlet 1 will need to dynamically create form2. I naturally will want a presentation control. Instead of doing out.println(“html code”), I want to use JSP and write direct HTML code. On the other hand, can JSP be used as a form action? So basically, in form 1, can I do <form action=”…/xxx.jsp”> I think I saw something like this, but I lack the comprehensive JSP knowledge to know for sure. More importantly, if hypothetically JSP can be used, how do I handle functions such as doGet(HttpServletRequest request, HttpServletResponse response), which is used in servlet1.
    Thank you,
    M

    no, servlets should not be used to generate a view, that is what a JSP is for. So let your backend servlet fetch the data, put it for example as attributes of the request scope (request.setAttribute()) and then forward control to a JSP that will generate the view, based on the information you stored in the request scope. That is the proper way of using servlets & JSPs; use servlets to invoke business logic classes, use JSPs combined with JSTL to generate the view. If you do it properly, you don't need ANY java code in your JSP.

  • Plz help me out new to jsp

    package abc;
    class UserDetails
    // i have used this class basically for declaration of variables.
    public class BulkSmsFunctions
    BulkSmsFunctions()
    {// constructor}
    // in this class i have 5-6 functions      
    public static void amin(String args[])
    // i have left my psvm as empty.
    }BulkSmsFunctions uses objects of UserDetails to assign various variables.
    now i have a jsp page which has to create an object of BulkSmsFunctions and call the various functions.
    i have the following code for the jsp page:
    <%@ page import = "java.util.*"%>
    <%@ page import = "java.lang.*"%>
    <%@ page import = "java.io.*"%>
    <%@ page import = "abc.*"%>//importing the package
    <html>
    <body>
    <%
    String PROVISIONING_LOG_PATH="C:\\bulksmsfolder";
    String USERS_ACTIVE_DETAILS_FILE="CountDetails";
    String USERS_PACKAGE_SUBSCRIPTION_LOGS_FILE="ServiceLog";
    String SERVICE_SUBSCRIPTION_PACKAGES_MASTER_FILE="PacksMasterFile";
    BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    try
    boolean SmsCountFlag = objBulkSms.processSmsCountDetails(PROVISIONING_MODULE_LOG_PATH,USERS_ACTIVE_SMSCOUNT_DETAILS_FILE);
    if(SmsCountFlag == false)
            out.println(" No file contents");
         catch (Exception e)
         out.println(" Exception in main     :" + e.toString());
    %>
    </body>
    </html>i am getting the following error.
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: tcs.BulkSmsFunctions is not public in tcs; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: tcs.BulkSmsFunctions is not public in tcs; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:56: BulkSmsFunctions() is not public in tcs.BulkSmsFunctions; cannot be accessed from outside package
         BulkSmsFunctions objBulkSms= new BulkSmsFunctions();
    ^
    An error occurred at line: 7 in the jsp file: /jsp/natasha/hello.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\natasha\hello_jsp.java:60: processSmsCountDetails(java.lang.String,java.lang.String) is not public in tcs.BulkSmsFunctions; cannot be accessed from outside package
              boolean SmsCountFlag = objBulkSms.processSmsCountDetails(PROVISIONING_MODULE_LOG_PATH,USERS_ACTIVE_SMSCOUNT_DETAILS_FILE);
    ^
    4 errors

    try
    modify constructor of BulkSmsFunctions to public as in
    public BulkSmsFunctions() { etc etc                                                                                                                                                                                           

  • System.out.println - Hello World Example

    Hi All
    I am using Apache Tomcat and trying t produce a simple output to the browser. Cannot get System.out.println to work. See code and out below:
    begin code
    <HTML>
    <HEAD><TITLE>hello jsp</TITLE></HEAD>
    <BODY>
    <%@ page language='java' contentType='text/html' %>
    <%
    String message = "Hello World";
    message = message + "\nAFTER";
    System.out.println("BEFORE");
    %>
    <%= (message) %>
    </BODY>
    </HTML>
    END code
    --begin browser output
    Hello World AFTER
    end browser ouput
    Would be grateful if someone could explain why the System.out.print statement cannot be seen in the browser output.
    many thanks
    Naresh

    System.out prints to System.out. What that is depends:
    In applets, (which the OP was not talking about) it is the Java Console.
    In JSP, it's the same as any application by default.
    You can change in Java what System.out prints to, but you don't often do this. But in JSP it doesn't print to the browser. JSP is not CGI, which does you the standard out as the destination for written data.

  • Problem with Out Reference in jsp

    Hi All
    Please Help Me
    My problem is
    <%
    ResultVo rvo=null;
    for(int i=0;i<alist.size();i++){
    rvo=(ResultVo)alist.get(i);
    %>
    <%=rvo.getData() %><%=rvo.getDel_tim() %>
    <%
    System.out.println("data"+rvo.getData()+""+i);
    System.out.println("dest"+rvo.getDest());
    } %>
    problem:
    1)here i am getting the first expression tag value
    in server it prints perfect (i mean all the values)
    but coming to jsp only the object first value printed on the jsp
    ex:
    alist.size() --10 objects
    and each object contains some values
    i repeated and try to print on the web using expression tag
    it prints only first object first value
    but i am in confusion what is the problem might be
    please help me
    thanking you

    u have to increment ur i
    add this to ur for:
    i++;

  • Problem Displaying out Data in JSP

    can anyone have a look at my code? i got some problems to display it in jsp when i run it with eclipse. can anyone help me on this?? did my java bean declared wrongly? thanks...
    this is my java file
    package com;
    import java.io.File;
    import com.db4o.Db4o;
    import com.db4o.ObjectContainer;
    import com.db4o.ObjectSet;
    import org.jfree.chart.*;
    import org.jfree.data.general.*;
    public class StoreData{
         private static final long serialVersionUID = 1L;
         private final static String filename = "C:\\CountryPieChart.yap";
         public static void main(String[] args){
              //Delete the existing file
              new File(filename).delete();
              ObjectContainer db=Db4o.openFile(filename);
              try {
                   StoreAllData();
                   retrieveAllData();
              } finally{
                   db.close();          //Close the database
         public static void StoreAllData() {
              //Delete the existing file
              new File(filename).delete();
              ObjectContainer db = Db4o.openFile(filename);
              //Add data to the database
              CountryPeople countryName_1 = new CountryPeople("Malaysia", 100);
              CountryPeople countryName_2 = new CountryPeople("New Z", 200);
              CountryPeople countryName_3 = new CountryPeople("UK", 300);
              CountryPeople countryName_4 = new CountryPeople("Thailand", 400);
              CountryPeople countryName_5 = new CountryPeople("Singapore", 50);
              //set the value to database
              db.set(countryName_1);
              db.set(countryName_2);
              db.set(countryName_3);
              db.set(countryName_4);
              db.set(countryName_5);
         public static void retrieveAllData() {
              //Open db
              ObjectContainer db = Db4o.openFile(filename);
              //Retrieve via empty object
              CountryPeople cName = new CountryPeople(null, 0);
              ObjectSet result = db.get(cName);
              DefaultPieDataset dataset = new DefaultPieDataset();
              //retrieve the data from database
              while(result.hasNext()) {
                   CountryPeople obj = (CountryPeople) result.next();
                   dataset.setValue(obj.getName(), obj.getValue());
                   //System.out.println(result.next());
              //Create pie chart
              JFreeChart chart = ChartFactory.createPieChart(
                        "Sample Chart",
                        dataset,     
                        true,
                        true,
                        false);
              try {
                   //save the pie chart as JPEG file
                   ChartUtilities.saveChartAsJPEG(new File("C:\\CountryPieChart.jpg"), chart, 500, 300);
              } catch(Exception e) {
                   System.out.println("Problem for creating chart");
    and this is my jsp file
    <jsp:useBean id="myStoreData" class="com.StoreData" scope="page"></jsp:useBean>
    <html>
    <head><title>Testing Displaying</title>
    </head>
    <body>
    <b>Testing Display Page</b>
    <img src="<jsp:getProperty name="myStoreData" property="getFileName" /> /">
    </body>
    </html>

    <img src="<jsp:getProperty name="myStoreData" property="getFileName" /> /">
    property="getFileName": There isnt such a property available in your bean.

  • Session problem in one out of two jsp

    Dear java guru's
    I have got jsp page A.jsp.User select few option and this jsp calls
    B.servlet this takes user input and pass to
    C.bean which returns vector to B.servlet
    This servlet put vector in session and dispatch to new jsp
    D.jsp which calls
    E.jsp in it for Image generation.
    This E.jsp retrieve vector from session and generate a image and reurn to D.jsp
    Now my problem is that session in B.servlet and D.jsp are same but a new session in created in E.jsp so image is null as it could get data from vector which is null.
    I put System.out.println(session.getId()) in each servlet and jsp so to get thier ID's.
    This is working fine in my system with Tomcat 3.2 but on web the new session is created for E.jsp
    I am calling E.jsp like this
    <img src=<%=response.encodeURL("/iscap/report/jspChart.jsp")%> alt="generation image" width="400" height="350" border="1">
    I am making page session=true in each jsp and also puttting request.getSession(false);
    but still E.jsp is getting new session.I tried eliminating each one and made all combination that could be possible but not effect.
    How Can I solve this problem on the web where I have to load this?
    Do I have to make setting in context .
    payal sharma

    Hi,
    If you have been using jspChart v 1.00 :
    As shown in the modified , attached PPT :
    I will be displaying a bar chart. The length of bar chart is obatined from Sybase database. This chart should be dynamically created depending on the value on
    the database and x -axis is exponential.
    This will be displayed on a HTML page.
    1. I want to know whether,the values can be obtained the values from Sybase database ?
    If so, what are the changes.
    2. can you tell me the steps to install and run the jspchart v 1.00 on Jrun or any server please.
    Any thing else, I need to install like SAX , JCLARK. I am getting errors in this. PL HELP.
    3. Is it possible to plot "Exponential values" in the Y-axis. like 0 - 100- 1000 - 10000 - 100000
    and the length of the Bar should automaticall be coloured till that Point as shown in the Power point attached.
    If not, any suggestions to use any other software.
    Thanks in advance.
    [email protected]

Maybe you are looking for

  • How do you get your ipod touch unlocked ? i have forgot the passcode.

    I have forgot my passcode to my ipod touch and its showing DISABLED now where i have the wrong passcode. How can i reset it or unlock it? I don't have the pc i first used when i bought my ipod touch.

  • CC trial installation fail

    I have just tried to install the 30 day trial of CC but the installation froze.  when trying to open from the desktop I just got a toolbar and blank screen.  I tried the troubleshooter but that did not solve the problem so I uninstalled the program b

  • XRPM Resource Management issue

    Gurus, In xRPM under Resource Management Tab. I am not able to find any resources under resource view.TAble is empty. Although I have created Resource pool and assinged a resources to administrator. Please let me know if i am missing any settings Tha

  • What is the best way to transfer iTunes from iBook G4 to new MacBook Pro?

    What is the best way to transfer iTunes from iBook G4 to new MacBook Pro?

  • Reducing the database size

    I have upgraded from a G5 desktop to a macbook pro. Wow, big speed increase. I have been increasingly going into photography and my aperture 3 (love it compared to version 2!) is at 500 or so gigs. That would include the imported iPhoto database. My