Home Answers Viewqa JDBC Integer Auto incremented ID not showing up

 
 


Sarbu Diana
Integer Auto incremented ID not showing up
1 Answer(s)      11 months ago
Posted in : JDBC

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 Pages:
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
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. package jdbc; import...); try { System.out.println("Using AUTO_INCREMENT key for 'id' field
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
MySQL Generate AlphaNumberic Id In JSP
. In the generated alpha numeric id only the integer value will be incremented...`), UNIQUE KEY `serial_id` (`serial_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3...MySQL Generate AlphaNumberic Id In JSP In this section we will discus about
After changing url params d req checkboxes are not showing as clicked in jsf programming - Java Server Faces Questions
After changing url params d req checkboxes are not showing as clicked in jsf... artistname then the respective albums(with their checkboxes) will show up like... getChild(Object id) { return (TreeNode) getArtists().get(id); } public
SimpleJdbcInsert, Retrieving auto-generated keys
SimpleJdbcInsert, Retrieving auto-generated keys The auto-generated keys can... of the auto generated key column can be specified by passing it's name to method "usingGeneratedKeyColumns". The column must be integer or long
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
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
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
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
id creation
id creation  CREATE TABLE mohan2 ( sno bigint(20) NOT NULL AUTO_INCREMENT, name varchar(30) NOT NULL, sal int(30) NOT NULL, eid varchar(30) NOT NULL, PRIMARY KEY (sno,eid) ) import java.sql.*; import
id generation
id generation  CREATE TABLE `mohan2` ( `sno` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `sal` int(30) NOT NULL... to employee id automatically generate please try this code, useful for u thanks 
Hiding and showing elements on the page
Hiding and showing elements on the page       Hiding and showing elements on the page...; <button id="hidb">Hide</button> <button id="
auto
auto  write a java code design an auto with as many feature as possible
Dependant & dynamic drop down list - Follow up
; <br> <div id='state'> <select name='state' >...` bigint(255) NOT NULL auto_increment, `countryname` varchar(255...(255) NOT NULL auto_increment, `countryid` int(255) default
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
MySQL Auto_Increment
AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (id...MySQL Auto_Increment This example illustrates how to define AUTO_INCREMENT of a field. The AUTO_INCREMENT attribute can be used to generate a unique
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
delete row using id
{ public static void main(String[] args) { // TODO Auto-generated method... = "delete from Insurance insurance where id = 2"; Query query = sess.createQuery...: delete [delete from pkg2.Insurance insurance where id = 2
Session ID - Java Beginners
Session ID  Do we get new session id for a new domain after clicking... = "Searching the Web"; String heading; Integer count = new Integer(0... { heading = "Welcome Back"; Integer oldcount = (Integer
Hibernate generation Id to postgreSQL
(name="car_id", unique=true, nullable=false) private Integer carId; @Column(name...Hibernate generation Id to postgreSQL  Hi, I'm trying to implement a id generator in Hibernate, but I'm having a problem. Hibernate doesn't seems
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
Pop-up Window
Pop-up Window  Hi......... please tell me How do I pass parameters to a pop-up window? Thanks  For example: code for pop-up window...:Form> <mx:FormItem label="First Name:"> <s:TextInput id
Auto generated column in sql 5.0 - SQL
Auto generated column in sql 5.0  hi, in my data base i have declared one column has auto generating but currently am not able to insert the data unless i need to pass some integer value to that column.. regards pramod.k.r
HIBERNATE COMPOSITE ID - Hibernate
HIBERNATE COMPOSITE ID  Hi, I have a database table structure as CREATE TABLE `attendance` ( `sno` int(11) NOT NULL auto_increment, `empRef` int(8) default NULL, `dat` date default NULL, `timeIn` time
Dojo Auto completer
Dojo Auto completer          In this section, you will learn how to create a auto completer in dojo.  Try Online: Auto Completer Auto Completer: The Auto Completer provides
jQuery to Auto Image Scroller
jQuery to Auto Image Scroller     ... that auto image scroller Steps to develop the program  Step 1...({ auto: 2, wrap: 'last', initCallback: mycarousel_initCallback
id
id  how to find date of birth and gender in id in html with the help of javascript
MySQL Auto_Increment
uniquely in a table. The Primary Key 'Id' has auto_increment property that can... NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (id... MySQL Auto_Increment      
how to declare a auto increment in sql - SQL
table form will get open. Click the checkbox option of Auto_Incrt for the field 'id...how to declare a auto increment in sql  Dear sir, How to declare a auto increment insql? i used a identity but it is nt working in sql,so
A connection pool with multiple user ID.
A connection pool with multiple user ID.  Can I set up a connection pool with multiple user IDs? The single ID we are forced to use causes problems when debugging the DBMS
Ajax Auto Complete Tutorial
Auto Complete Example The auto complete feature helps the user to input the data correctly and quickly while submitting the form. An example of auto...;autocomplete" id="autocomplete"/> </td> </tr> <
Setting up Database with the help of PHP Scripts.
_contacts(ID int(10) NOT NULL auto_increment, First_Name varchar(30) NOT NULL...PHP Database Set Up Script Part-5(c) : Setting up the database 2. Database... in the last tutorial that MySQL has its own standard set up to create database which
Html form that auto fills outlook to,subject,body
Html form that auto fills outlook to,subject,body  I want to have...;form> To: <input type="text" id="mTo" /><br /> Subject: <input type="text" id="mSubject" /><br /> <textarea id="mBody">
Hibernate's Built-in criterion: Between (using Integer)
Hibernate's Built-in criterion: Between (using Integer... will learn to use "between" with the Integer class. "Between" when used with the Integer object, It takes three parameters e.g.  between("
Auto Complete Text Box - JSP-Servlet
Auto Complete Text Box - JSP-Servlet  Auto Complete Text Box Please...; </head> <body> <input id="name" type="text" name="name" onkeyup="showState(this.value)"> <br> <div id='country'>
print the multiplication table up to one
print the multiplication table up to one  My problem is that I have to change the code so that the user can tell the program which factor that should...; System.out.println("Enter an integer to print it's multiplication table
how to add Arraylist filter for a jsp page showing results from a servlet
how to add Arraylist filter for a jsp page showing results from a servlet  hello sir/mam, in my project i have an arraylist showing results in a jsp... is as: student_id class_id student_name 1x0001 10 Ashish 1x2001 11
Setting up the database in PHP
to leave the ID field blank because it will be auto generated. If you...PHP DATABASE Setup Part-5(a) : Setting up the database In this chapter, we... database is that it has its own standard set up to create database which
iBatis-Showing all data from database
iBatis-Showing all data from database   .... This example is all about to read data from the database and showing the results... IF EXISTS `contact`; CREATE TABLE `contact` (    `id` int
Using Hibernate <generator> to generate id incrementally - Struts
Using Hibernate to generate id incrementally  Hi All, How to increment id using Hibernate ( or if any other) to generate id. I am using..... Mr.Sandeep. we do have many generator algorithms for our id, So you are incrementing id
Hibernate Built-in criterion "between" Integer
minimum and maximum integer value range. In this example I will fetch the id...Hibernate Built-in criterion "between" Integer In this tutorial you...; with the integer values. Hibernate provides the facility to make a Criteria query
how to auto generate number in jsp with the database connection mysql for employee number?
how to auto generate number in jsp with the database connection mysql for employee number?  how to auto generate number in jsp with the database...("SELECT id FROM user"); int id=0; if(rs.last()){ id=rs.getInt("id")+1
how to auto generate number in jsp with the database connection mysql for employee number?
how to auto generate number in jsp with the database connection mysql for employee number?  how to auto generate number in jsp with the database...("SELECT id FROM user"); int id=0; if(rs.last()){ id=rs.getInt("id")+1
jQuery auto complete through database using JSP
jQuery auto complete through database using JSP In this tutorial, we will implement auto complete through database using JSP. In this example a text box is given, when you enter name of any Indian state , it will auto complete
Pop up Very Very Urgent - JSP-Servlet
in the database. When I click Employee ID present in the pop up box, The "Enter Employee ID...Pop up Very Very Urgent  Respected Sir/Madam, I am... the code.. Here When I click "View Database" Button,a small pop up window must
Setting up MySQL Database and Tables
` ( `id` INT NOT NULL AUTO_INCREMENT... Setting up MySQL Database and Tables   ... and descriptions. Here is the complete sql script for setting up the database
How to store two integer value in a separate file and retrieve those values
How to store two integer value in a separate file and retrieve those values  I need to save two values so i can use those values later i came up with idea of saving those values in a separate file and updating values in file