Share on Google+Share on Google+

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

Ads

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?  <[email protected] import="java.sql.*"%>..."); Integer i=0; out.println("hi"); while(rs1.next()) { Integer k=Integer.parseInt(rs1.getString(10)); i=i+k
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
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
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
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
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
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
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
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="
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
Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads