Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Integer Auto incremented ID not showing up

Have Programming Question? Ask it here!
 
 
 


Sarbu Diana
Integer Auto incremented ID not showing up
1 Answer(s)      2 years and a month 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>

Advertisement
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
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
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
auto
auto  write a java code design an auto with as many feature as possible
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
id
id  how to find date of birth and gender in id in html with the help of javascript
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
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
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
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
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
auto resize
auto resize  Dear Sir, I have a table with 60 coloumns and 90 rows.If i give the print option it s not comin in one page.Can you please tell me the javascript code for auto resizing it into one window or fit to the window while
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
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
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
What is Auto Wiring?
What is Auto Wiring?  Hi, What is Auto Wiring? Thanks
auto update codings
auto update codings  auto update coding in xml
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
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
pop up
pop up  how to create pop up in html
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="
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 
total id
total id  how to print and total my id number ..for example if my id is 0123456789 the output will look like this : 0123456789 0+1+2+3+4+5+6+7+8+9=45 help me plz
Session ID
Session ID  How can I change the session ID of the page?   ...' session ID values because it is very likely to result in the loss of the session or with people acquiring other users' data. The session ID value should be managed
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
auto sql script - SQL
auto sql script  Is there a way of generating inserts scripts using the table structure for oracle database
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
Date auto format
Date auto format  Hi, I have jsp page and Date field with input type. Requirement is, if we enter date as MMDDYY or MMDDYYYY and clicking the tab the date(MMDDYY or MMDDYYYY) have to auto format to MM/DD/YYYY. could you please
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
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
Auto field update
Auto field update  In my application I have a field called status which is having the 4 values like new,submitted,approved, rejected. How to set those filed in Database(MySQL), and how to auto update that field status in other
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... is the example code: String s =request.getParameter("myvariable"); Integer i
Yahoo Auto Suggest
Yahoo Auto Suggest  Am using Yahoo Library for Auto Suggest and it is implementing well.. My Requirement is I've two radio buttons with a and b and its name is stype. When i selected a, I'll get a different suggestions
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
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
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
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
Showing Error for Prepared stmt in a jsp
Showing Error for Prepared stmt in a jsp  i hav a task to connect jsp to oracel database using preparestatement and gettin an error showin dat prepared statement obj cant be created pstmt is nt resloved here are the files
Showing Error for Prepared stmt in a jsp
Showing Error for Prepared stmt in a jsp  i hav a task to connect jsp to oracel database using preparestatement and gettin an error showin dat prepared statement obj cant be created pstmt is nt resloved here are the files
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
Initializing Integer Variable issue?
Initializing Integer Variable issue?  My program is supposed to take a phrase like you'd see on a TV commercial, for example: "Call 1-800-GETLOAN now... problem is my integer variables (number0 - number6). It is forcing me to initialize
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
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
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
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
 

 

 

DMCA.com