Integer Auto incremented ID not showing up

Integer Auto incremented ID not showing up

SearchStudent.jsp

Student to search into database

         <script language="javascript">
            function validate2(objForm){

                int k = 0;
                if(objForm.name.value.length==0){
                    objForm.name.focus();
                    k++;
                }

                if(objForm.year.value.length==0){
                    objForm.year.focus();
                    k++;
                }

                if(objForm.id.value.length==0){
                    objForm.year.focus();
                    k++;
                }

                if(k == 0){
                   return false;
                }
            return true;
            }
          </script>

FoundStudents.jsp

<%
Student search = null;
 if(request.getParameter("seek_stud") != null){

        //reading params from the SearchStudent form
        String name = request.getParameter("name");
        String year_prime = request.getParameter("year");
        int year, id;

        try{
            year = Integer.parseInt(year_prime);
        }catch(Exception e1){
            year = 0; 
        }

        String id_prime = request.getParameter("id");
        try{
            id = Integer.parseInt("id");
        }catch(Exception e2){
            id = 0;
        }


        if(name.length() != 0){
            search = StudentsManager.getInstance().studByName1(name);
        }

        if(year > 0){
           search = StudentsManager.getInstance().studByName2(year);
        }

        if(id > 0){
           search = StudentsManager.getInstance().studByName3(id);
        }    

%>

<html>
        <body bgcolor=#4AA02C>
        <center>
            <h2>Student's data</h2>
            <table border="1" cellspacing="1" cellpadding="8" bgcolor= #EBDDE2> 
            <tr>
                <td bgcolor= #FF9966><b>ID</b></td>
                <td bgcolor= #FF9966><b>Name</b></td>
                <td bgcolor= #FF9966><b>Year</b></td>
            </tr>
                <tr>
                  <td><%= search.getId()%></td>
                  <td><%= search.getName()%></td>
                  <td><%= search.getYear()%></td>
                </tr>
            </table>
            </center>
        </body>
    </html>
<%}%>

I get org.apache.jasper.JasperException: java.lang.NullPointerException

org.apache.jasper.JasperException: An exception occurred processing JSP page /FoundStudents.jsp at line 58

55:                 <td bgcolor= #FF9966><b>Year</b></td>
56:             </tr>
57:                 <tr>
58:                   <td><%= search.getId()%></td>
59:                   <td><%= search.getName()%></td>
60:                   <td><%= search.getYear()%></td>
61:                 </tr>
View Answers

June 30, 2012 at 10:10 PM

Please consider the question deleted. I changed the code ;)









Related Tutorials/Questions & Answers:
Integer Auto incremented ID not showing up
Integer Auto incremented ID not showing up  SearchStudent.jsp..."); int year, id; try{ year = Integer.parseInt(year_prime...; } String id_prime = request.getParameter("id"); try{ id
Auto Generated Employee ID
Auto Generated Employee ID  Hello Everyone I want to generate an ID like (SCS-0001) and then it should be auto incremented each time a new employee add page is opens. I am using My Sql database
Advertisements
ModuleNotFoundError: No module named 'core-module-auto-key-integer-sequence-app'
ModuleNotFoundError: No module named 'core-module-auto-key-integer-sequence-app...: ModuleNotFoundError: No module named 'core-module-auto-key-integer-sequence-app...-module-auto-key-integer-sequence-app After the installation of core-module
JDBC: MYSQL Auto_Increment key Example
field of table auto_incremented using JDBC API. Auto_Increment key : Auto...; and declaring field 'id' as AUTO_INCREMENT. ADS_TO_REPLACE_1 package jdbc..., password); try { System.out.println("Using AUTO_INCREMENT key for 'id
how to genrate login id and password after submitting the sign up form?
how to genrate login id and password after submitting the sign up form?  i m working on a online voting project in that i have a user sign up form so i want 2 knw that after user submit all the details i that sign up form than
String Date incremented in .jsp
String Date incremented in .jsp  I am an utter novice in jsp, but I need to make an amendment to a .jsp file in our organization. I need to set a String in the .jsp to be a date which is derived as Todays Date plus 90 days
auto
auto  write a java code design an auto with as many feature as possible
Showing div at the center of the webpage
Showing div at the center of the webpage  Showing div at the center of the webpage
why the program is showing error?
why the program is showing error?  <%@page import="java.sql.*"%>..."); Integer i=0; out.println("hi"); while(rs1.next()) { Integer k=Integer.parseInt(rs1.getString(10)); i=i+k
Maven Repository/Dependency: cn.vertxup | vertx-up
Maven Repository/Dependency of Group ID cn.vertxup and Artifact ID vertx-up. Latest version of cn.vertxup:vertx-up dependencies. # Version Release Date 1 0.8.0 28 Feb
integer to string
integer to string  i have to develop a program which convert integer into character from 1 to 10,000 if we input 1 then it give output 'one' n so on till 'ten thousand' kindly give me the codes plzplz sir........   Have
Stumped with NOT NULL AUTO_INCREMENT
to create a new table with the ID column being NOT NULL AUTO_INCREMENT... TABLE fb_$user_id ( id MEDIUMINT NOT NULL AUTO...Stumped with NOT NULL AUTO_INCREMENT  I've almost made it through my
showing the information of database in textbox
showing the information of database in textbox  how to make a information of a database make appear to the user in the textbox
Maven Repository/Dependency: com.dongxiguo | auto-parser
Maven Repository/Dependency of Group ID com.dongxiguo and Artifact ID auto-parser. Latest version of com.dongxiguo:auto-parser dependencies. # Version Release Date You can read more
Maven Repository/Dependency: com.infstory | auto-parse
Maven Repository/Dependency of Group ID com.infstory and Artifact ID auto-parse. Latest version of com.infstory:auto-parse dependencies. # Version Release Date 1 1.0.0
Maven Repository/Dependency: com.alta189 | auto-spark
Maven Repository/Dependency of Group ID com.alta189 and Artifact ID auto-spark. Latest version of com.alta189:auto-spark dependencies. # Version Release Date 1 1.1 01
how to generate auto code ?
how to generate auto code ?  i wanna genrate auto code for id in core java. pls tell me code of auto genrate
Login And Sign up
Login And Sign up  how do you create a login and sign up that will automaticly add users and passwords after activation link from auto confirmation email is opened
pop up
pop up  how to create pop up in html
compiled but showing below error
compiled but showing below error  Good morning, By using axis api, am getting the following error but the wsdl file is generating. what is the mistake I done. Unable to find required classes (javax.activation.DataHandler
hibernate record not showing in database - Hibernate
hibernate record not showing in database  session =sessionFactory.openSession(); //inserting rocords in Echo Message table...)); //It showing on console Records inserted 21 But not showing in database
jframe background color not showing
jframe background color not showing  jframe background color is not showing. please suggest.   Just add the background color to JPanel and then add it to JFrame. For example .. JFrame myFrame = new JFrame(); JPanel
id
id  how to find date of birth and gender in id in html with the help of javascript
Maven Repository/Dependency: com.gu | mongodb-auto-discovery_2.11
Maven Repository/Dependency of Group ID com.gu and Artifact ID mongodb-auto-discovery_2.11. Latest version of com.gu:mongodb-auto-discovery_2.11 dependencies. # Version Release Date
Maven Repository/Dependency: com.infstory | auto-parse-processor
Maven Repository/Dependency of Group ID com.infstory and Artifact ID auto-parse-processor. Latest version of com.infstory:auto-parse-processor dependencies. # Version Release Date You can
Maven Repository/Dependency: com.oguzbabaoglu | auto-value-querymap
Maven Repository/Dependency of Group ID com.oguzbabaoglu and Artifact ID auto-value-querymap. Latest version of com.oguzbabaoglu:auto-value-querymap dependencies. # Version Release Date
Maven Repository/Dependency: io.norberg | auto-matter
Maven Repository/Dependency of Group ID io.norberg and Artifact ID auto-matter. Latest version of io.norberg:auto-matter dependencies. # Version Release Date 1 0.26.2
Hiding and showing elements on the page
Hiding and showing elements on the page       Hiding and showing elements on the page...; </head> <body> <button id="hidb">Hide<
Maven Repository/Dependency: com.christiangp | auto-value-nested-tostring
Maven Repository/Dependency of Group ID com.christiangp and Artifact ID auto-value-nested-tostring. Latest version of com.christiangp:auto-value-nested-tostring dependencies. # Version Release Date
Maven Repository/Dependency: io.opentelemetry.instrumentation.auto | opentelemetry-auto-hibernate-common
Maven Repository/Dependency of Group ID io.opentelemetry.instrumentation.auto and Artifact ID opentelemetry-auto-hibernate-common. Latest version of io.opentelemetry.instrumentation.auto:opentelemetry-auto-hibernate-common dependencies
Maven Repository/Dependency: com.tuyenmonkey | auto-fill-edit-text
Maven Repository/Dependency of Group ID com.tuyenmonkey and Artifact ID auto-fill-edit-text. Latest version of com.tuyenmonkey:auto-fill-edit-text dependencies. # Version Release Date You
ModuleNotFoundError: No module named 'integer'
ModuleNotFoundError: No module named 'integer'  Hi, My Python... 'integer' How to remove the ModuleNotFoundError: No module named 'integer... to install padas library. You can install integer python with following command
Integer exception in java
Integer exception in java       The integer class is a wrapper for integer value... want to store an integer in a hash table, you have to "wrap" an Integer
swap two integer arrays
swap two integer arrays  int [] array1 = {1,2,3,4,5} int [] array2 = {6,7,8,9,10} how can we swap the values of bith integer arrays results like this array1 = {6,7,8,9,10} array2 = {1,2,3,4,5
swap two integer arrays
swap two integer arrays  int [] array1 = {1,2,3,4,5} int [] array2 = {6,7,8,9,10} how can we swap the values of bith integer arrays results like this array1 = {6,7,8,9,10} array2 = {1,2,3,4,5
swap two integer arrays
swap two integer arrays  int [] array1 = {1,2,3,4,5} int [] array2 = {6,7,8,9,10} how can we swap the values of bith integer arrays results like this array1 = {6,7,8,9,10} array2 = {1,2,3,4,5
uinavigationcontroller back button not showing/ missing
uinavigationcontroller back button not showing/ missing  Hi, In my application i am calling another view using pushviewcontroller from my root view but ... somehow in the next view uinavigationcontroller back button not showing
Maven Repository/Dependency: io.norberg | auto-matter-jackson
Maven Repository/Dependency of Group ID io.norberg and Artifact ID auto-matter-jackson. Latest version of io.norberg:auto-matter-jackson dependencies. # Version Release Date 1
get integer at run time
get integer at run time  how to get integer value at run time in j2ee using servlets   Hi, You can get the value from request parameter... Here is the example code: String s =request.getParameter("myvariable"); Integer
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE
AUTO_INCREMENT=20; INSERT INTO FEE_CLASS_CATEGORY_NAME(CLASS_CATEGORY_ID) SELECT CLASS_CATEGORY_ID FROM FEE_CLASS_CATEGORY; UPDATE FEE_CLASS_CATEGORY_NAME...SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE  I AM
Reverse integer array program
Reverse integer array program  Been tasked with the following question: Write a method that accepts an integer array and returns a new array with all the elements in reverse order. For example, if the input array is [2, 4, 6, 8
accept integer from user
accept integer from user  Write an Java application that accepts 100 integer numbers from a user. The input should be in the range of 1-200. Error message needs to be displayed if user entered input which is not in this range
Maven Repository/Dependency: com.christiangp | auto-value-nested-tostring-annotations
Maven Repository/Dependency of Group ID com.christiangp and Artifact ID auto-value-nested-tostring-annotations. Latest version of com.christiangp:auto-value-nested-tostring-annotations dependencies. # Version
Showing error in the driver declaration.Please suggest
Showing error in the driver declaration.Please suggest  org.apache.jasper.JasperException: Exception in JSP: /LogIn/8June.jsp:15 12: String driver = "org.gjt.mm.mysql.Driver" 13: //String connectionURL = "jdbc:mysql
Integer display problem
Integer display problem  class Bean{ int n1,n2; public Bean(){ } public Bean(int n1, int n2){ this.n1=n1; this.n2=n2; } public static void main(String arg[]){ Bean b1=new Bean(010,50); System.out.println
pop up window in java
pop up window in java  How to open a pop up window in Java
javascript integer to string conversion
javascript integer to string conversion  How to Javascript Integer to String Conversion   <script type="text/javascript"> /** * print out the value and the type of the variable passed
convertig biginteger value into integer
convertig biginteger value into integer  I want to parse a BigInteger class variable into integer like BigInteger p = BigInteger.valueOf(10); now i want to convert p value into int . I searched so many times on google to solve
ModuleNotFoundError: No module named 'up'
ModuleNotFoundError: No module named 'up'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'up' How to remove the ModuleNotFoundError: No module named 'up' error
POP UP WINDOW
POP UP WINDOW  Dear Sir, Can you please help in providing the methos for opening up a pop up window just after selecting an option from a drop...',then a pop up window should open with name,designation and roll number.Please help me

Ads