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



Home Answers Viewqa JDBC Integer Auto incremented ID not showing up
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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

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
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
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
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
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
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
pop up
pop up  how to create pop up in html
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
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 
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
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
auto sql script - SQL
auto sql script  Is there a way of generating inserts scripts using the table structure for oracle database
<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
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
Advertisements
 

 

 

DMCA.com