Jsp doubt

ANY ONE CAN HELLP MEEEEEE
i have 20 records in my table .how to display 5 records in each page when i click on the next button??????
Message was edited by:
suvarnasivabhavan

Hi.
Regarding the navigation , U need to handle it in ur code.
Or else while fetching it from the database , fetch 5 records at a time.but u need to keep thrack of the records fetched.....
hope this helps

Similar Messages

  • Basic JSP doubt

    Hi all,
    I tried developing a simple login application from one of the tutorials available on NET. I have a login.jsp page which takes the Username and password as input and the corresponding form action is done by a login Servlet. But i get the following error
    The requested resource (/onjava/servlet/com.onjava.login) is not available.
    Here is my login.jsp page:
    <html>
    <head>
    <title>OnJava Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" onLoad="document.loginForm.username.focus()">
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td>
    <img src="/onjava/images/monitor2.gif"></td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    </table>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <form name="loginForm" method="post"
    action="servlet/com.onjava.login">
    <tr>
    <td width="401"><div align="right">User Name: </div></td>
    <td width="399"><input type="text" name="username"></td>
    </tr>
    <tr>
    <td width="401"><div align="right">Password: </div></td>
    <td width="399"><input type="password" name="password"></td>
    </tr>
    <tr>
    <td width="401"> </td>
    <td width="399"><br><input type="Submit" name="Submit"></td>
    </tr>
    </form>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    Here is my web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
    'http://java.sun.com/j2ee/dtds/web-app_2_3.dtd'>
    <web-app>
    <servlet>
    <servlet-name>login</servlet-name>
    <servlet-class>com.onjava.login</servlet-class>
    </servlet>
    <taglib>
    <taglib-uri>/onjava</taglib-uri>
    <taglib-location>/WEB-INF/lib/taglib.tld</taglib-location>
    </taglib>
    </web-app>
    I have copied the login.class to WEB-INF/classes/com/onjava/ folder. But still i get the same error. Am i doing anything wrong. Please clarify.

    So the tutorial you used is an old one that used the invoker servlet to be able to call un-mapped servlets via /servlet/<class-name>
    This pracice is discouraged now, and most of the time the invoker servlet is turned off.
    Add this to your web.xml after the <servlet> definition:
            <servlet-mapping>
                <servlet-name>login</servlet-name>
                <url>/login</url>
            </servlet-mapping>then change your form tag to have the action="login". This will map the servlet to a url you want to use. You then invoke that url (when the form is submitted) and get the servlet to run.

  • Doubt in JSP recordset

    Hi i have a doubt in jsp...first i don know much abt jsp so iam gonna trying out a project on supermarket system.Here i have three tables Items,Bill and Report.Iam using three resultset continuously and i have error saying no resultset found.I have sent the code can anyone plz help me correcting it.
    <%
    String item= request.getParameter("itemadd");
    String qr=request.getParameter("quanreq");
    HttpSession Dsess=request.getSession();
    String refer = (String)Dsess.getAttribute("user");
    Date dd = new Date();
    SimpleDateFormat sdf1 = new SimpleDateFormat("dd");
    String date = sdf1.format(dd);
    Date mm = new Date();
    out.println(date);
    SimpleDateFormat sdf2 = new SimpleDateFormat("MMM");
    String mon = sdf2.format(mm);
    Date yy = new Date();
    SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy");
    String year = sdf3.format(yy);
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con=DriverManager.getConnection("jdbc:odbc:honeydew"," "," ");
         Statement st= con.createStatement();
         ResultSet rs = st.executeQuery("Select * from Items where Iname = '"+item+"' ");
         String uni = new String();
         String pri = new String();
         while(rs.next())
              uni = rs.getString(4);
              pri = rs.getString(5);
         ResultSet rs4 = st.executeQuery("update Items set Quantity = Quantity - '"+qr+"' where Iname ='"+item+"' ");
         ResultSet rs2 = st.executeQuery("insert into Bill values('"+item+"','"+qr+"','"+uni+"','"+pri+"','"+refer+"')");
         ResultSet rs2 = st.executeQuery("insert into Report values('"+item+"','"+qr+"','"+uni+"','"+pri+"','"+date+"','"+mon+"','"+year+"')");
    catch(Exception e)
    %>
    <html>
    <body bgcolor="#CCDDEF">
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.lang.*" %>
    <%@ page import = "java.util.Date" %>
    <%@ page import = "java.text.*" %>

    Hi
    When you are doing either update or insert database operations, use Statement.executeUpdate("insert . . . . "), which will return how many rows are effected. So instead of
    ResultSet rs1 = stmt.executeQuery("update ......"); use the following
    stmt.excuteUpdate("update ...... ");

  • Help me -doubt in jsp

    hai
    In my jsp page one checkbox is there.
    when i check the checkbox then another on textarea will popup
    and vice versa
    plese help me
    it is very urgent
    thank you

    * dont doubt JSP it has proven its worth.
    * checking checkbox and hidding/showing textareas is not in your JSP but in the HTML that is send to your client by making a request to your JSP, its a detail but a very important one
    * This means you need Javascript that will change the style of yor HTML components, have a look at a javascript onclick or onchange events and at the DOM model.
    * example
    yourtextarea.style.visibility = 'hidden'

  • Doubt in JSP

    hi ,
    i was new to JSP, when iam learning jsp, i worte a jsp file for performing session tracking using jsp:usebean tag , for that i create a bean and i generate a class and i put that class in classes folder.
    here i got a problem, when i call this in browser i got an error...... class not found. after trying 3 to 4 times i got the same error. i dont know why the error. i wrote all the code correctly and i deploy my application perfectly.
    after that i got an idea to put that class in a package now i got the result without any error.
    Why did we create a new package to perform beans????????

    There's no doubt in my mind you are correct. :)
    Or did I just prove you wrong beyond a doubt? ;)
    Neither. He used the construct "to have a doubt" as a verb, which is incorrect as the word can't be used like that.
    Of course even if it could the very meaning of the word is quite different from the intended "question" as "doubt" doesn't mean question at all but rather "reservation" (and no, that's not a reservation to a theater seat or restaurant table).

  • JSP / HTML doubt ...

    Hi every one!
    My doubt may seem to be a waste doubt, but its a doubt,so..,
    Can we use JSP tags(like <%,<%=) in a servlet program.
    And can we use a JSP tag in between or inside a html tag as.,
    <a href=my.html name=<%=val%> >Hi</a> ,,where val is a string object holding some string say Hi.Can we use like this?
    Plz guide me! Thnkz in advance...

    Yes, like Yogesh mentioned it is possible to include a JSP expression
    <%=someVariable%> inside the value attribute of an HTML tag.
    However, there is a new and improved way of doing this. In case you are using the latest versions of everything - JSP 2.0 , Servlet 2.4 etc
    instead of using a JSP expression like this <%=someVariable%> , now you can do it in a much simpler syntax with EL like this ${someVariable}If you install JSTL 1.1 and configure it , there are much simpler and better ways to do things with JSPs now.
    For example this JSP scriptlet :
    <%
    for (int i=0; i < 10; i++){
        out.println(i);
    %>could be written in JSTL inside a JSP as
    <c:forEach begin="1" end="10" var="index" step="1">
        ${index} <br/>
    </c:forEach>The above is just a small example and doesn't show all the benefits of JSTL, but when the application grows large if one uses just JSP scriptlets and expressions the code becomes unmanageable.
    With JSTL the code looks much cleaner , simpler as it encapsulates all business logic to the business layer.
    If you are new to JSPs then you can get familiar with scriptlets and expressions, but I encourage you to make use of the benefits of JSTL after you become familiar with the basics of JSPs.
    Message was edited by:
    appy77

  • Simple Doubt in JSP

    I have a set of check boxes and corresponding text boxes in a HTML form. I want to display the text box value if the corresponding check box is checked.
    Can anybody tell me how to accomplish this?

    I have a set of check boxes and corresponding text
    boxes in a HTML form. I want to display the text box
    value if the corresponding check box is checked.
    Can anybody tell me how to accomplish this?when are you trying to display the text box value? After they hit a submit button or something? If thats true then you can if you want write a servlet or jsp which will handle the POST action. Then you can get the value depending on what you named it in them in the JSP.
    So if you named your field something like:
    <input type="text" name="text_one"/><input type="checkbox" name="mycheckbox" value="one"><br>
    <input type="text" name="text_two"/><input type="checkbox" name="mycheckbox" value="two"><br>
    <input type="text" name="text_three"/><input type="checkbox" name="mycheckbox" value="three"><br>
    Now you can do:
    String[] checkBoxValues = request.getParameterValues("mycheckbox");
    for(int i = 0; i < checkBoxValues.length; i++) {
    if(checkBoxValues.equals("one"))
    System.out.println(request.getParameter("text_one");
    else if(checkBoxValues[i].equals("two"))
    System.out.println(request.getParameter("text_two");
    else if(checkBoxValues[i].equals("three"))
    System.out.println(request.getParameter("text_three");
    Obviously there probably way better ways to do this but this should at least lead you in the right direction.
    -Chuy

  • Doubt in jsp or oracle

    hi everyone,
              i'm working with a jsp code which uses oracle as backend i come across
              a statement like this
              rs2=st2.executeQuery("select name from emp where ecode='"+ecode+"'");
              what the + mean in --"+ecode+"
              is it related to jsp or oracle,
              help me in bebuging the code
              

              That is from your JSP, "ecode" in ecode is a variable in your JSP.
              [email protected] (kasi) wrote:
              >hi everyone,
              >i'm working with a jsp code which uses oracle as backend i come across
              > a statement like this
              >
              >rs2=st2.executeQuery("select name from emp where ecode='"+ecode+"'");
              >
              >what the + mean in --"+ecode+"
              >is it related to jsp or oracle,
              >help me in bebuging the code
              

  • Can anyone clarify my doubt in a simple JSP Program ?

    when we write a simple jsp program such as helloworld.jsp does a
    class file or servlet be created when we run the jsp program using a
    web browser and Tomcat ? if so please tell the folder(path) in tomcat
    where this class file will be located or stored .Thankq

    JSPs will (usually) be compiled into class files representing Servlets, yes. But that's something that happens internally inside the application server and shouldn't concern you.
    Why would you need to know where it resides? It seems like a code smell if you need that information.
    If you're just curious, then look into the work directory of your tomcat.

  • JSP Include - Doubt

    Can i use dynamic value on the tag
    <%@jsp include page=dynamicValue/%>

    Why don't you just try it?

  • Doubt about equals on a jsp

    Hi all,
    I'm writing as I have this problem ....
    This simple JSP SHOULD print on the same page the user name if both his name and surname have been inserted in a form:
    <html>
    <head><title>Primo esempio di pagina jsp</title></head>
    <body>
    <br>
    <br>
    <form method="post">
    <input type="text" name="nome"> <input type="text" name="cognome">
    <input type="submit" value="invia">
    </form>
    String nomemio = (String)request.getParameter("nome");
    String cognomemio = (String)request.getParameter("cognome");
    <%if (!(nomemio.equals("")) && (!(cognomemio.equals("")))) {
    out.println("Benvenuto: "+request.getParameter("nome"));
    }%>
    </body>
    </html>
    The problem is this: Apache Tomcat (I use the version 5.5.12) throws lots of exceptions
    java.lang.NullPointerException
         org.apache.jsp.esFrancescoVerona_jsp._jspService(org.apache.jsp.esFrancescoVerona_jsp:59)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    NullPointerException at line 59 of the servlet generated by this jsp deals with the comparison between the strings nomemio and cognomemio against the empty strings (parameter of equals) !!!!
    How can I do to solve this problem?
    Thanks

    NullPointerException - what do you think this
    message means?????
    It's not a trick question!?
    <%
    String nomemio =
    = (String)request.getParameter("nome");
    String cognomemio =
    = (String)request.getParameter("cognome");
    if ( nomemio != null && cognomemio != null )
    <%= "Benvenuto: "+nomemio %>
    %>HTH.I tried even this but it displays Benvenuto (Welcome in Italian) even if I click on submit button without filling the cognome and nome fields

  • Pls help me writing logic:iterate tag in jsp page

    Hey guys , I am struck in retriving string p1,p2,p3 in the jsp page
    Pls have a look ata the code
    In DAO class:-
    StdprdDAO.java
    Public arrayList getPFP()
    ArrayList a = new ArrayList();
    While(rs.next())
         columnsVO colVO = new columnsVO;
         colVO.setProduct(rset.getString(1));//will store in String colProduct
         colVO.setFamily(rset.getString(2));//will store in String colFamily
    colVO.setPrice(rset.getString(3));//will store in String colPrice
    a.add(colVO);
    return a;
    In Action Class:-
    ArrayList final = null;
    StdprdDAO DAO = new stdprdDAO();
    final = DAO.getPFP();
    For(int i = 0; final !=null && i<final.size() ; i++)
         columnsVO VO = null;
         VO = (columnsVO)final.get(i);
         String p1 = (String) VO.getProduct();
         String p2 = (String) VO.getFamily();
         String p3 = (String) VO.getPrice();
         Request.setAttribute(“p1”,p1);
         Request.setAttribute(“p2”,p2);
         Request.setAttribute(“p3”,p3);
    In JSP PAGE:-
    id = “columnsVO”>
    <bean:write name = “columnsVO” property=”final” id=”p1”>
    but still I am doubting my above sentences in jsp page ,so pls correct them if possible.
    Instead of l;ogic:iterate can I use directly getattribute(“p1”)? <logic:iterate
    Still I m doubting I can not utilize columnsVO file in logic:iterate, I can utilize only formbean file.
    So pls help me with this.

    May I ask why have you done it?
    If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
    It has the list we want to print out.
    With logic:iterate:
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <logic:iterate name="compEmployees" property="totalEmps" id="emp">
              <tr>
                <td>
                  <bean:write name="emp" property="empNo"/>
                </td>
                <td>
                  <bean:write name="emp" property="empName"/>
                </td>
              </tr>
         </logic:iterate>
    </table>or alternatively with JSTL and c:forEach
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <c:forEach items="${compEmployees.totalEmps}" var="emp">
              <tr>
                <td>
                  <c:out value="${emp.empNo}"/>
                </td>
                <td>
                  <c:out value="${emp.empName}"/>
                </td>
              </tr>
         </c:forEach>
    </table>Cheers,
    evnafets

  • How to get the data of table from JSP to Servlet?

    Hi,
    I have a dynamic editable table of 3 columns on a jsp. On click on any cell the usr can edit the data. Now on click of submit button on the jsp I need to submit or get the whole data of all the rows to a servlet which would further process it.
    How do I do that?
    TIA.

    I am not sure whether u r getting my doubt or not
    properly. I am populating the table data in an
    arraylist of DO. with this arraylist I am displaying
    the data on the Screen.
    <%
    for(int i=0;i<alList.size();i++)
    DO d = alList.get(i);
    %>
    <Table>
    <tr>
    <td><%=d.getfirstField()%></td>
    <tr>
    </Table>
    <%
    %>
    The above code sniipet displays the data on screen.
    But as table being editable i would change the data
    in the cell and submit .
    So how do i capture this data? I cannot name the cell
    becos I am not sure how many rows would be displayed.
    In servlet I would use request.getParameter(?);
    TIAIf you table is editable nad has input field to edit then "malcolmmc's " answer will work perfectly.
    you can also use hidden form fields to use those vaues at servlet like this
    <input type="hidden" name="UniqueName' value="<%=d.getfirstField()%>'>
    Here UniqueName should be the unique for each cell value so that on servlet you can fetch these values using request.getParameter("UniqueName").

  • How to call a method in one JSP from another JSP?

    say that I have 2 JSPs.
    JSP one has a button.
    JSP two has some method that, say, find the square root of the number passed from JPS one.
    How to - when click - the button on page one call the method on page two?
    Please note that I can not use object binding, but I want passing the actual parameter and call the method on page two.
    Please note that this is an update of a previous post on the same topic called "Object scope".
    Thank you all very much.

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • Some doubts in FI-SL?

    hello friends,
    I have doubts in fi-sl,
    there are two tables, summary table and ledger.
    why we activate summary table first?
    in ledger selection,why so mnay ledgers la,lb,lc like that is there.
    for every single ledger means bank take example ,
    shall we have to assign to every single ledger there la or lb or lc.
    plz let me know the process wiht one scenarion.
    srinu

    Hi,
    1) a) A Web Server understands and supports only HTTP protocol whereas an Application Server supports HTTP,TCP/IP and many more protocols.
    b) Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object.
    c) Webserver is used only for jsp and servlets and for static functionality it has limited functionality and it doesn't provide any security ,persistence and it doesn't support EJB and JMS and JAAS like other functionality
    whereas Application server provide all functionalities.
    In short, Applicaion Server is a super set of which Web Server is a sub set.
    2) Two-tier architecture is a client/server architecture , where a request to do some task is sent to the server and the server responds by performing the task.where as a three-tier or a multi tier architecture has client, server and database. Where the client request is sent to the server and the server in turn sends the request to the database. The database sends back the information/data required to the server which inturn sends it to the client.

Maybe you are looking for