Do paging with header on a JSP page

Hi:
We have a data report displayed as a JSP page. The report displays 200 rows of data. We need to print these 200 rows report with a header/title on each page. And our user only wants to hit he Browser print button once. This would have been easy if we don't have to insert the header on each print page. But how can we print this multiple page report with a header? Do we need to use CSS? any help will be appreciated.
reportPrinter

Okay bear with me:
Step 1: determine how many rows in a table with a header will print on a single page
Step 2: Create a jsp that breaks your data down into tables of the row size determined above.
For example if the data consists of 1000 rows and 50 rows w/ headers will fit on a page
then the jsp will create 20 tables of 50 rows w/ headers each.
Step 3: Use CSS to put page breaks between the tables.
http://www.htmlgoodies.com/beyond/css_print.html
Step 4: In the original JSP use the HTML LINK tag to link it to the JSP you just created
http://www.gself.com/xbas/head/linking.htm
<link rel="alternative" href="{new JSP url}" type="text/html" media="print" />
Step 5: On the original JSP provide a button that when clicked on will call the JavaScript print function.
Now what should happen is that when the button on the original JSP is clicked the JavaScript print function will be called but instead of the page displayed in the browser being printed the alternative page
in the LINK tag will get printed. This alternative JSP page is formatted to print one table with headers per page.
The only part of this that I have not used in a production web app iss the CSS page break part. The rest of it I know will work.

Similar Messages

  • Button action with onclick in a jsp page using Jscript

    hi,
    I am facing a problem in setting an action with a button in a jsp page the error is object does'nt support this function,kindly send me reply as soon as possible.
    Santhosh

    hi,
    I am facing a problem in setting an action with a button in a jsp page the error is object does'nt support this function,kindly send me reply as soon as possible.
    Santhosh

  • Problem with bean in a JSP page

    I have developped a JSP pages in wich I call a bean with
    <jsp:useBean id="db" scope="request" class="SQLBean.class" />
    The bean SQLBean.class is in the same directory as the JSP page.
    When I execute the JSP, I have the following error:
    SQLBean.class db = (SQLBean.class) JSPRuntime.instantiateBean("db", "SQLBean.class", "request", __db_was_created, pageContext, request, session, application);
    Syntax error: [expected after this token
    Syntax error: "]" inserted to complete ArrayAccess
    Syntax error: "AssignmentOperator AssignmentExpression" inserted to complete StatementExpression
    I use JRUN with IIS
    Thanks for the help

    I am assuming your class name is SQLBean.
    use:
    <jsp:useBean id="db" scope="request" class="SQLBean" />
    instead of:
    <jsp:useBean id="db" scope="request" class="SQLBean.class" />

  • Using a Statefull Session Bean with RMI on Multiple JSP pages

    Heya all,
    i have a JBoss server running with a statefull bean on it. I want to use it on my JSP pages. But every time I start my JSP-page a NEW INSTANTION of the bean is created! For each user using my page, I want ONE bean.
    Is there anyway to do this? ANything with the sessioncontext?
    I can do it with local beans, using the simple tags in the JSP-page, but they do not work for Remote Beans.
    (I use JNDI)

    hi,
    statefull session beans are client session specific. the instance will exists if client session exits.
    now since u are loading the jsp page again in the other browser, a new instance will be associated with the current session.
    hope it will work.
    sameer

  • Help with buttons on a JSP Page

    Hi All,
    I have a HTML page , that has certain text fields.... on entering values into the text fields, it is directed to a servlet.
    The servlet(puts the values into the database) then directs to a jsp with the values entered in the form.
    I would like to know whether on the jsp page i can have 2 buttons like "edit" and "OK".
    (how do I code it???)
    The "edit" button edits the information on the initial HTML page and
    The "OK" button just confirms the inputted information.
    I hope I have asked a clear question.It would be great if someone directs me in the right direction.
    Thanking everyone in advance
    AS

    I hope I've understood your question correctly. Let
    me see if I got it right. So the first page is the
    form, where the user inputs the information, the
    second page will display this information that they
    inputted from the previous page and then have two
    buttons, one that says edit and the other that says
    ok. Upon hitting edit they're sent back to the form
    with the values already filled out, if they hit OK,
    the data is inserted into the database. If this is
    correct, this is how I would do it.
    You will have 3 files
    parameters.jsp
    <%
    String firstname =
    = request.getParameter("firstname");
         String lastname = request.getParameter("lastname");
    %>form.jsp
    <%@ include file="parameters.jsp">
    <html>
         <body>
              <form action="confirmation.jsp" method="post">
    <input type="text" name="firstname" value="<%=
    <%= firstname %>">
    <input type="text" name="lastname" value="<%=
    <%= lastname %>">
                   <input type="submit">
              </form>
         </body>
    </html>confirmation.jsp
    <%@ include file="parameters.jsp">
    <html>
         <body>
    <!-- the action of this form will be the page that
    at inserts the data into the database -->
              <form action="insertintodb.jsp" method="post">
    <input type="text" name="firstname" value="<%=
    <%= firstname %>">
    <input type="text" name="lastname" value="<%=
    <%= lastname %>">
                   <input type="submit" value="OK">
              </form>
              <form action="form.jsp" method="post">
    <input type="hidden" name="firstname" value="<%=
    <%= firstname %>">
    <input type="hidden" name="lastname" value="<%=
    <%= lastname %>">
                   <input type="submit" value="Edit">
              </form>
         </body>
    </html>
    Hi,
    Thanks a lot for the information.I will try to do as you have suggested.Will post when i go into problems...
    Many thanks
    AS

  • Help With Integrating Servlet and JSP Page?

    Hello There
    --i made jsp page that contain name and description fields and add button
    --and i made servlet that contain the code to insert name and description in the database
    --and i want to make that when the user hit the add button
    -->the entered name and description is sent to the servlet
    and the servlet sent them to database?
    here's what i 've done:
    the jsp code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="jpage.jsp" method="get">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="submit" value="Add" name="button" />
           </h3>
       </form>
        </body>
    </html:html>the servlet code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    class NewServlet1 extends HttpServlet{
         Connection conn;
         private ServletConfig config;
    public void init(ServletConfig config)
      throws ServletException{
         this.config=config;
    public void service (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
       HttpSession session = req.getSession(true);
       res.setContentType("text/html");
    try{
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
         PreparedStatement ps;
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, "aa");
          ps.setString (3, "bb");
          ps.executeUpdate();
          ps.close();
          conn.close();
      }catch(Exception e){ e.getMessage();}
      public void destroy(){}
    }

    The JSP Code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="actionServlet.do?action=Additem" method="*post*">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="button" value="Submit">
           </h3>
       </form>
        </body>
    </html:html>The Servlet Code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    public class NewServlet1 extends HttpServlet implements SingleThreadModel {
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
            doPost(request,response);
        public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
              String action = request.getParameter("action"); // action = "Additem"
              if (action.equals("Additem")) {
                   String name = request.getParameter("name");
                   String description = request.getParameter("description");
                         RequestDispatcher reqDisp = null;
                   try{
                  Connection conn;
                  PreparedStatement ps;
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, name);
          ps.setString (3, description);
          ps.executeUpdate();
          ps.close();
          conn.close();
          reqDisp= request.getRequestDispatcher("./index.jsp");
          reqDisp.forward(request, response);
                   catch (Exception ex){
                        System.out.println("Error: "+ ex);
    }The web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
            <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet>
            <servlet-name>NewServlet1</servlet-name>
            <servlet-class>NewServlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>NewServlet1</servlet-name>
            <url-pattern>/NewServlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
            <servlet>
         <servlet-name>actionServlet</servlet-name>
         <servlet-class>com.test.servlet.NewServlet1</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>actionServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
    </servlet-mapping>
        </web-app>

  • Help!!! What's wrong with this code. JSP page can't retrieve properties.

    I'v got a piece of code that was created to send some parameters to JSP page via POST method. But in server page I can't retrieve this parameters, please help me and try to find "main" bug in this code.
    try {
    URL url = new URL("http://localhost/index.jsp");
    HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
    httpCon.setRequestMethod( "POST" );
    httpCon.setDoOutput( true );
    String body = URLEncoder.encode("name=Oleg", "UTF-8");
    httpCon.setRequestProperty( "Content-length", Integer.toString( outBody.length() ));
    httpCon.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    ow.close();
    } catch (....) {
    }

    Hi
    You must not encode all the body just the values of the parameters.
    You can do as following in order to send a post request with 2 parameters
    String param1 = "Co & sons";
    String param2 = "ltd.";
    String encParam1 = URLEncoder.encode(param1,"UTF-8");
    String encParam2 = URLEncoder.encode(param2,"UTF-8");
    String body = "param1="+encParam1+"&param2="+encParam2;
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    //read the response from the jsp
    InputStream inS = httpCon.getInputStream();
    byte[] buff = new byte[5000];
    StringBuffer sbuff = new StringBuffer();
    int nrBytes ;
    while( (nrBytes = inS.read(buff, 0, 5000))!=-1) {
      sbuff.append(new String(buff,0,nrBytes));
    inS.close();
    ow.close();
    ...This is the jsp page which gets the parameters
    <%
         String param1 = request.getParameter("param1");
         param1 = new String(param1.getBytes(),"utf-8");
         String param2 = request.getParameter("param2");
         param2 = new String(param2.getBytes(),"utf-8");
    %>I hope I helped you.
    Regards,
    BG

  • Help with Jtext fields on JSP page?

    Hi All,
    How can I collect an integer on a JSP page from user input?
    I am looking to vallidate the user input also thought about vallidating using HTML then passing/casting the input to a Java variable for further manipulation on the page.
    I cannot use response.encodeUrl for this.
    Effectively what I would like to do is replicate what a JTextField with an action listener would do to retrieve user input in a desktop Java application.
    Any ideas and help would be welcome.
    regards
    Jim Ascroft

    Hi All ,
    I propbably didnt put my questions all that well.
    So I wil try to be more specific.
    1.How can I collect an integer on a JSP page from user input?
    I am looking to vallidate the user input. I thought about vallidating using HTML then passing/casting the input to a Java variable for further manipulation on the page.
    I cannot use response.encodeUrl for this.
    2.I understand that my Java helper classes are compiled into .class files and then used by the JSP page as required. Also the Java code within the <% %> Java tags is recognised and runs .
    So if the java between the <% %> tags can be compiled and used why can other Java components eg Swing or AWT not be used in the same way?
    Effectively what I would like to do is replicate what a JTextField with an action listener would do to retrieve user input in a desktop Java application.
    Any ideas and help would be welcome.
    regards
    Jim Ascroft

  • Paged query results in a JSP page

    Hi All,
    I have a requirement to display only a small number of records (say 50) in a JSP page at a time from a database query that returns more than 10,000 records. For accessing all the other records I have to provide links from the same page. I should be able to go to the first, last, next & previous sets of records at any time. Database is Oracle and the table I am using to query doesn't have a serial number column. Any easy way? Thanks Raj

    Hi Raj,
    There are two ways to handle it.
    One is to fetch the entire set of record from the Database and store the details in a Container which has session level context. But if the fetched size is higher then Session cannot hold that much amount of data.
    Alternatively you can go about fetching fixed chunks of data from the
    Database(preferably of size 50 to 100). This can be achieved using SQL queries. I have done this and seems to work pefectly in situations where large data available in Database has to be displayed pagewise to the users. (U will find the query in AskTom site of Oracle Corporation).
    Please revert back if any further help is needed in this regard.
    Ilamparithi

  • Help with header field on multiple pages

    I am trying to print three multiple page documents.  The first document in the dat file has data in a header comment field.  The last two documents in the dat file do not have data for the header comment field. On the form I have defined this comment field as global.  When I print the documents the first document comment is being printed on the last two documents that should not have comments.
    If I remove the global condition for the comment field, then the comment is only printed on the first page of the first multiple page document.  Is it possible to print the comment on each page of the first multiple page document and not print the comment on the documents that should not have a comment?  Thanks for any help.

    Got it. Thank you. I'm having one other problem though. I
    keep getting this bizare message every time i save or try to use
    the template:
    The is an error at line 41 column 7 (absolute position 2486)
    of "~pathandfilename.dwt": Nested editable regions
    The only thing at line 41 is the <body> tag. I took all
    the formating out to try to trim this out... any thoughts about
    this one.
    Thanks G

  • Unable to run simple empty jsp page with weblogic 10.3.6.0.

    Dears,
    I have a simple war with simple empty welcome jsp page, when i deploy my project on AdminServer domain, jsp displays correctly, but if i deploy it on other domain i got this exception :
    java.lang.ClassCastException: org.apache.jasper.runtime.JspWriterImpl cannot be cast to weblogic.servlet.jsp.ByteWriter
         at jsp_servlet.__index._jspService(__index.java:63)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
         at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:327)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    I'm using weblogic 10.3.6, any help will be appreciated.
    regards.

    dunnsoftinc wrote:
    During the initial pass, I decided to leave this password null in both places, which is documented within the peopletools 8.53.00 installation guide. Maybe, it's time to further test. Thank you Nicolas.To be honest I've never tried to leave it blank in previous releases, thought that was mandatory (it was not prompted in psadmin menu as it is with PT8.53).
    I don't have a PTools 8.53 instance in hands right now, but after a quick test over here on PT8.51, I have the same issue as yours.
    Let me also remind you that there are two separate scenarios that may be received via the sign-on page:
    1.) "The application server is down" status message without the "bea.jolt.ServiceException: TPESVCERR - server error while handling request" error.
    2.) "The application server is down" status message including the "bea.jolt.ServiceException: TPESVCERR - server error while handling request" error.As I said earlier, you should get more clue in the webserver logfiles.
    Nicolas.

  • Sending mail from JSP page with attachment

    I have a requirement to send mail with attachment from my jsp pages, which should come to a particular mail box. Can any one help me by sending sample codes. Thankx in advance.

    hi,
    When request is posted you have to save file data from request to a file. you can not access the data using request.getParameter("file").

  • Display multiple Images from a DB on a JSP Page!

    Hi all, please give me your solution, thanks. I have many images, stored in Oracle database (BLOB), How to display all of them (images) on a JSP page? I have a working solution that only shows one image based on the specific image-name passed. But if no image found in the Database with that image-name then I want to show all the images at once on a JSP page. Can someone help please. Follwing are the code snippets:
    Here is the JSP page that calls the servlet to show the images:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>untitled</title>
      </head>
      <body valign=center>
          <table>
            <tr>
                <td>
                    <img src="/test-testimgs-context-root/servlet/test1.images.servlet.GetImage">
                </td>
            </tr>
          </table>
      </body>
    </html>
    Here is the code that resides in the service method of GetImage servlet:
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
        OutputStream stream = response.getOutputStream(); 
        Blob imgBlob = null;
        ResultSet rs = null;
        byte[] imbBytesAry = null;
        try
            ImageTest imgtest = new ImageTest();
            rs = imgtest.get("img1.tif");
            if(rs != null)
                while(rs.next())
                    imgBlob = rs.getBlob(1);
                    int len = new Integer( new Long( imgBlob.length()).toString() ).intValue();
                    imbBytesAry = imgBlob.getBytes(1,len);
                    if (imbBytesAry.length == 0 || imbBytesAry == null)
                        noImageFound(request, response); 
                    else
                        stream.write(imbBytesAry);
            else
                noImageFound(request, response);
        catch (Exception e)
            noImageFound(request, response);
    Here is the code that resides in the get method of ImageTest class:
    public ResultSet get(String fileName) throws DatabaseConnectionException, SQLException, Exception
    Connection connection=null;
    ResultSet rs = null;
    ResultSet rs1 = null;
    Blob imgBlob = null;
    try
        connection = new ConnectionProvider().getCConnection() ;
        connection.setAutoCommit(false);
        Statement stmt = connection.createStatement();
        String sql = "SELECT IMG FROM IMAGE_TABLE WHERE IMAGE_NAME = ? "; 
        PreparedStatement pstmt = connection.prepareStatement(sql);
        pstmt.setString(1,fileName);
        rs = pstmt.executeQuery();
        boolean flag = rs.next();
        if(flag)
            rs.beforeFirst();
        else
            sql = "SELECT IMG FROM IMAGE_TABLE"; 
            rs1 = stmt.executeQuery(sql);
            boolean flag_all = rs1.next();
            if(flag_all)
                rs1.beforeFirst();
            else
                rs1 = null;
        return rs;
    }As you see in the JSP page I am calling GetImage servlet, whose service method does all the processing i.e. calls ImageTest get method that queries the database and returns the result. Eventually what I would like is to pass the filename along with other parameters from JSP page and the servlet returns the images based on that. Currently I have just hard coded a value for testing puposes. Any help is appreciated.
    Thanks

    Hi all, please give me your solution, thanks. I have many images, stored in Oracle database (BLOB), How to display all of them (images) on a JSP page? I have a working solution that only shows one image based on the specific image-name passed. But if no image found in the Database with that image-name then I want to show all the images at once on a JSP page. Can someone help please.
    this is the code
    <form name="a" action="" method="post">
    <%
    rs1 = st1.executeQuery(select1);
    rs1.next();
    while(rs1.next())
    %>
    <table>
    <tr><td>
    <%
    Blob objBlob[] = new Blob[rs1.getMetaData().getColumnCount()];
         for (int i = 0; i <= rs1.getMetaData().getColumnCount(); i++)
               objBlob[i] = ((OracleResultSet)rs1).getBLOB(1);
              InputStream is = objBlob.getBinaryStream();
    byte[] bytearray = new byte[4096];
    int size=0;
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    while((size=is.read(bytearray))!= -1 )
    response.getOutputStream().write(bytearray,0,size);
    response.flushBuffer();
    is.close();
    out.println("hhhhhhh");
    %>
    </table>
    <%
    rs1.close();
    //con.close();
    %>
    </form>

  • How to use extends attribute in jsp page directive

    Can anybody tell how to extend a existing .jsp file from another .jsp file. I have tried but it gives error.
    I have used Extends attribute of page directive as below:
    <%@ page extends = "MyAnotherJsp.jsp"%>
    I also tried : <%@ page extends = "MyAnotherJsp"%>
    I am using Tomcat as a web server
    Also tell where to put those files.
    Thanks.

    Hi I am using Netbeans 5.5, Sun Java System Application Server 9.
    ABC.java
    package javapackage;
    public class ABC{
    public String show(){
    return "Sandip Gaikwad";
    index.jsp
    <%@ page extends="javapackage.ABC" %>
    <html>
    <head>
    <title>JSP Page</title>
    </head>
    <body>
    <h1>JSP Page </h1>
    </body>
    </html>
    Above code throws following exception at runtime:-
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    [javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,,boolean,int,boolean)
    [javac] pageContext = _jspxFactory.getPageContext(this, request, response,
    [javac] ^
    [javac] 1 error
    Server log
    StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    [javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,<nulltype>,boolean,int,boolean)
    [javac] pageContext = _jspxFactory.getPageContext(this, request, response,
    [javac] ^
    [javac] 1 error
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    If I delete the line <%@ extends="javapackage.ABC"%> it works fine. Please tell me what is wrong with this line.

  • Passing values between jsp pages

    Hi all,
    I am a newbie to jsp. I am trying to pass value from one jsp to another.
    Let me post the code here and make my point clear. I have 3 jsp pages and am trying to get the value into my 3rd page that was in the first page.
    This is my Test.jsp page:
    <%@page contentType="text/html"%>
    <html>
    <head><title>Test JSP Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Testing.. JSP Page
    <FORM action='Response.jsp' method="POST">
    <input type='Text' name='get_name'>
    <input type="submit" value="Click Me">
    </FORM>
    </body>
    </html>
    This is my response.jsp page:
    <%@page contentType="text/html"%>
    <%@page import = "sun.jdbc.rowset.CachedRowSet" %>
    <html>
    <head><title>Response Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Thank you... <%=request.getParameter("get_name") %>
    // I want to pass this get_name to my next page, but since request.getParameter returns an object and not a string, how will I capture the value and pass it to my next page.
    </body>
    </html>
    The 3rd jsp page is:
    <%@page contentType="text/html"%>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    // I am trying to get the value of the name here in this page.
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    </body>
    </html>
    Your help is appreciated.
    Thanks

    Hi,
    Thanks for the reply, it works. I was wondering whether this is an efficient way of doing this. What I want to do further is to setup a connection to a database and use the value I got from my previous page to query the DB and get the results and display.
    I have see some code in the java website and a lot of people do by writting a bean /class(believe bean is just a class) and then importing it and do the things that way. I have good knowledge of OO and Java as a language and would definitely love to do it this way.
    What i think i am missing is the basic idea to doing this way. So if you could let me know how to do this using java classes I would really appreciate it. If its too much to explain can u point to some good source(URL's) that explain's this. I have searched on this and all i find is code with no good explaination.
    Thanks a lot

Maybe you are looking for

  • How to check my payment info?

    My Apple ID always notice me check my payment info recently. I know the reason is my credit card is an International card, my Apple ID is U.S. ID. But here are two questions: 1, I have purchased an iPhone5S in Apple online store by same ID and same c

  • How to add a new custom paper size? I am using a HP Deskjet 1000 J 110a printer.

    How to add a new custom paper size? I am using a HP Deskjet 1000 J 110a printer. I am using Windows XP home edition. The Custom option itself is not appearing in the process of selecting paper sizes in Printing preferences. I have installed this prin

  • Stop DIA work process with PRIV mode in my program

    Hello, I  write Program that display in the end an alv report and when i display it after same time my dia wp get in PRIV mode I search about it and I didn't find the solution but it happend only with my program this reject the memory parameter that

  • Matchcode Object for fiels STRAS in SANS1

    Hello All, The table SANS1 conatims the field STRAS for street for 35 charcaters and STRAS_MC as the matchcode object for this field which is of 16 characters in upper case. I want to create a search help. Its working fine with STRAS_MC but with only

  • How do I create in Illustrator the same effect of 'color burn' in Photoshop?

    How do I create in Illustrator the same effect of 'color burn' in Photoshop? I am trying to create a rainbow effect by bleding the colors but need this in Illustrator.