Home Tutorialhelp Comment Error in the java code

 
 

Comment

dhanildas
Error in the java code,
November 18, 2009 at 12:23 PM

try this one,

import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Authentication extends HttpServlet{

private ServletConfig config;

public void init(ServletConfig config)
throws ServletException{
this.config=config;
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{

PrintWriter out = response.getWriter();
String connectionURL = "jdbc:mysql://localhost:3306/das";
Connection connection=null;
ResultSet rs;
int flag=0;
String userName=new String("");
String passwrd=new String("");
response.setContentType("text/html");
try {
// Load the database driver
Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
connection = DriverManager.getConnection(connectionURL, "root", "root");
//Add the data into the database
String sql = "select user,password from user";
Statement s = connection.createStatement();
s.executeQuery (sql);
rs = s.getResultSet();
while (rs.next ())
{
userName=rs.getString("user");
passwrd=rs.getString("password");
if(userName.equals(request.getParameter("user")) &&passwrd.equals(request.getParameter("pass")))
{
out.println("User Authenticated");
flag=1;
break;
}
}

if(flag==0)
out.println("Not a user now " );
rs.close ();
s.close ();
}catch(Exception e){
System.out.println("Exception is ;"+e);
}


}
}
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
JSP Servlet Questions

SSL Authentication - JSP-Servlet
SSL Authentication  With the help of a sample code describe the use of SSL Authentication of java clients 

Java Beginners

login authentication - Java Beginners
login authentication  i 've designed the jsp page for login. now i need to connect it with the bean and do authentication for the login for the "register" table in mysql. can anybody help me with the code immediately 

Java Beginners

Login authentication & mysql - Java Beginners
Login authentication & mysql  Hi , Could you guide or provide sample coding for the following scenerio. I need to code authentication for user... Authentication with MySql using Java Swing: 1)Create a java class 

JDBC Questions

Authentication
code snippet gives an error. Identify the reason for the error and give the correct code... a method ValidateLogin(). The developer writes the following code snippet to handle 

Java Beginners

login authentication - Java Beginners
and java bean. cud u pls help me. here is the bean and jsp code samples. after... to successloging java bean code -------------- public void...) {} } --------------------------------------------------------- jsp code 

Java Beginners

jsp code error - Java Beginners
jsp code error  Hi, I have a problem with following code... part. Is it possible to display a message box or alert box in jsp code??. plz help...; Hi friend , Try this code: /*out.println("Login Failed 

JSP Servlet Questions

jsp page authentication panel using jsp/servlet?
jsp page authentication panel using jsp/servlet?  I have 10 jsp jsp forms and 7 users and i want to grant variour permission like edit,delete and save for users dynamically on forms.So please refer me code 

JSP Servlet Questions

java Compilation error:jsp code - JSP-Servlet
java Compilation error:jsp code   I am getting an Generated Servlet error: String literal is not properly closed by a double-quote. here is my code: <% { Dbclass2 d= new Dbclass2 

JSP Servlet Questions

jsp code error - JSP-Servlet
jsp code error  hello, is anyone here who can solve my problem. what happen experts where r u? r u not able to do 

JSP Servlet Questions

jsp code error - JSP-Servlet
jsp code error  hello, is anyone here who can solve my problem. what happen experts where r u? or u r not able to do 

JSP Servlet Questions

jsp code error - JSP-Servlet
jsp code error  I have a jsp page named "tMastDepartment".which has some table row containing text box like 'project code','Departmentcode','employee... there is the problem which i am facing.what will be the exact code 

JSP Servlet Questions

Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send me code as soon as possible.   Please visit the following links 

JSP Servlet Questions

code error - JSP-Servlet
code error  hii this program is not working becoz when the mouse... is error in this progrm. ss function describe() { window.status... complaint   Hi friend, Do some changes in your code to solve 

Java Beginners

JSP code
JSP code  I get an error when i execute the following code : <%@ page language="java" contentType="text/html; charset=ISO-8859-1... = con.createStatement(); st.executeQuery(query); %> <jsp:forward page="address.jsp"> 

JSP Servlet Questions

jsp error - JSP-Servlet
, The 404 or Not Found error message is an HTTP standard response code indicating...jsp error  HTTP Status 404 - /jsp... message /jsp/ description The requested resource (/jsp/) is not available 

Java Beginners

jsp error
jsp error  <p>hi, could please help whenever i run jsp file in my eclipse i got this error.my jsp file is</p> &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding 

JSP Servlet Questions

authentication - JSP-Servlet
 

JSP Servlet Questions

JSP Page Error
i run jsp page on the browser it only shows the code nothing else.. I have...JSP Page Error  Hello Sir. I m using Oracle 10g as a database n...; <%@ page language ="java" %> <%@ page import="java.sql.*" %> 

JSP Servlet Questions

JSP Page Error
i run jsp page on the browser it only shows the code nothing else.. I have...JSP Page Error  Hello Sir. I m using Oracle 10g as a database n...; <%@ page language ="java" %> <%@ page import="java.sql.*" %> 

JSP Servlet Questions

JSP Page Error
i run jsp page on the browser it only shows the code nothing else.. I have...JSP Page Error  Hello Sir. I m using Oracle 10g as a database n...; <%@ page language ="java" %> <%@ page import="java.sql.*" %> 

JSP Servlet Questions

Login Authentication and session in JSP - JSP-Servlet
Login Authentication and session in JSP  Hi, I am creating an small application in JSP,in which i need to check user authentication and session on each JSP page.Also how do i make logout page. Can you help me 

JSP Servlet Questions

jsp error - JSP-Servlet
jsp error  Hello, my name is sreedhar. i wrote a jsp application... and showing the data base code and the connecction code. please help me to come... sending data insert into database code 

JSP Servlet Questions

JSP Error - JSP-Servlet
JSP Error  When i am running my registration.jsp getting following error. HTTP Status 500... description The server encountered an internal error () that prevented it from fulfilling 

JSP Servlet Questions

Programming Error - JSP-Servlet
have to use java mail to send a text message to my clients so i have to use this java mail but i need to understand this code.So please explain me this code...); System.out.println("Message Send....."); } } I have not understood this code 

JSP Servlet Questions

jsp code compilation error - JSP-Servlet
jsp code compilation error  hai, iam doing online banking project.i... is the error and also what is the proper code for funds transfer. HTTP... The server encountered an internal error () that prevented it from fulfilling 

JSP Servlet Questions

Java runtime error - JSP-Servlet
Java runtime error  Following Error is showing when i way...:52) at org.apache.jsp.index_jsp._jspService(index_jsp.java:119... Friend, Please send your code. Thanks  import java.io.File; import 

JSP Servlet Questions

compilation error - JSP-Servlet
compilation error  Hi sir, i'm using following code to upload...) org.apache.jsp.upload_005fpage1_jsp._jspService(upload_005fpage1_jsp.java:73...(longblob)) in the database and try the following code: <% String 

JSP Servlet Questions

Login Authentication using existing Active Directory.
Login Authentication using existing Active Directory.  I need jsp code for login authentication of username and password using already existing Active Directory. Here no need to create active directory.The JSP code should 

JSP Servlet Questions

jsp error - JSP-Servlet
jsp error  how to remove below error:: exception... not been initialized. Anyways post your code. Thanks  my code... newpo.jsp:   JSP Page 

JSP Servlet Questions

jsp
the code.</p> <p>first form(project Manager.jsp) &lt;%@ page language = "java" import = "java.sql.<em>" import = "java.util.</em>" import = "java.io.*" errorPage = "" %> <jsp:useBean id = "formHandler 

JSP Servlet Questions

jsp
the code.</p> <p>first form(project Manager.jsp) &lt;%@ page language = "java" import = "java.sql.<em>" import = "java.util.</em>" import = "java.io.*" errorPage = "" %> <jsp:useBean id = "formHandler 

JSP Servlet Questions

jsp error - JSP-Servlet
jsp error  To Upload and insert the file into oracle Database with Current Date and Time In JSP and my project is online library management system... database. Try the following code: 1)page.jsp: Display file upload form 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  i have created an employee table in mysql and connected it using JDBC, now i have to do client side validations, can u please... code 

Java Beginners

jsp code - Java Beginners
JSP code and Example  JSP Code Example 

JSP Tutorials

Error page in JSP
Error page in JSP In this section we will discuss about "Error page... the JSP page a runtime error may occur inside the page or outside the page. JSP... they are as follows: Using standard Java exception handling code, you can catch and handle 

JSP Servlet Questions

javax servlet error - JSP-Servlet
getting the error below, when im trying to enter my web page.. Please help me...: Servlet.init() for servlet jsp threw exception...: javax/servlet/jsp/JspFactory (Unsupported major.minor version 49.0 

JSP Servlet Questions

JSP Translation error - JSP-Servlet
. ----------------------------------------------- An error occurred at line: 2 in the jsp file: /stud..., in this code there is no error Thanks Rajanikant...JSP Translation error  Hello friends, In a new file 

JSP Tutorials

Login Authentication using Bean and Servlet In JSP
Login Authentication using Bean and Servlet In JSP... developed a web application of login authentication using Bean  in JSP. Five...;welcome.jsp","LoginBean.java" and "login.java" in the code 

JavaMail Questions

send without authentication mail using java - JavaMail
send without authentication mail using java  Dear All, I am tring to send simple mail without authentication using java. is it possible, could i send email without authentication. I have written following code. public 

MySQL

Login Authentication in JSP
of code is written to send data to JSP page by setting attribute ..."); Full code of JSP page is given as below: 2. selectbox.jsp <... from database This example will describe you the use of Select Box in a JSP 

JSP Servlet Questions

Error in using java beans - JSP-Servlet
Error in using java beans  I am getting the following error when I run the jsp code. type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request 

JSP Servlet Questions

JSP - JSP-Servlet
JSP  Hi! I want to know how to display error messages in JSP... color when authentication failed. How to do this in JSP.... Thanks... code: http://roseindia.net/jsp/loginbean.shtml We hope that this link 

JSP Tutorials

How to create and use custom error page in jsp
How to create and use custom error page in jsp       This is detailed java code how to create and use custom error page in jsp and display an error message. Before run 

JSP Servlet Questions

this code will be problem it display the error again send jsp for registration form
this code will be problem it display the error again send jsp for registration form  I AM ENTERING THE DETAILS OFTER IT DISPLAY THE ERROR PLEASE RESEND THE CODE org.apache.jasper.JasperException: java.lang.NumberFormatException 

JSP Servlet Questions

this code will be problem it display the error again send jsp for registration form
this code will be problem it display the error again send jsp for registration form  I AM ENTERING THE DETAILS OFTER IT DISPLAY THE ERROR PLEASE RESEND THE CODE org.apache.jasper.JasperException: java.lang.NumberFormatException 

JSP Servlet Questions

JSP
, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java code inside the JSP page. You can learn about JSP at our JSP Tutorials section 

JSP Servlet Questions

JSP code - JSP-Servlet
JSP code  Hi! Can somebody provide a line by line explanation of the following code. The code is used to upload and download an image. <... have successfully upload the file by the name of: Download /*Code 

JSP-Tutorials

JSP Error 500
JSP Error 500          JSP Error 500 is to generate error status 500 in jsp.  The Error 500 occurred when the server encounter an internal error 

JSP Servlet Questions

Java or Jsp code - JSP-Servlet
Java or Jsp code  Hello Sir, How to create the code for the password recovery page(like forgot gmail password question and answer page)using the radion buttons in display the same page in jsp.I need only how to make 

JSP Servlet Questions

Java compilation error - JSP-Servlet
\Sema\org\apache\jsp\employee_005fupload_005fprofile_005fimage_jsp.java:9: package...\apache\jsp\employee_005fupload_005fprofile_005fimage_jsp.java:11: package...*; ^ An error occurred at line: 18 in the jsp file: /employee_upload_profile 

JDBC Questions

jsp error - JDBC
jsp error   in this code the else part is nt executing atall... of that a error is like-----------"java.sql.SQLException: [Microsoft][ODBC Driver Manager... the line is not getting incremented u r getting that error just do this change 

JSP Servlet Questions

JSP error
JSP error  what is difference between global-exception and error-page in jsp. which condition they are use 

JSP Servlet Questions

Java Code - JSP-Servlet
Java Code  Write a JSP program which displays a webpage containg arrival of new items within a particular month in the different branches of a retail company 

JSP Servlet Questions

Script error - JSP-Servlet
running this it shows an error as "STACK OVERFLOW". Correct the code . The code... then send me jsp code. Thanks 

JDBC Questions

JSP SQL Error
JSP SQL Error  Hi While trying to execute the below code i'm getting the following error "java.sql.SQLException: Io exception: Got minus one from a read call ". please help me out. <% try{ String Username 

JSP Servlet Questions

jsp code problem - JSP-Servlet
jsp code problem  Hi, I have employee details form in jsp. After... friend, Please give me detail and send me error code page. Please.... http://www.roseindia.net/jsp/ Thanks 

JSP Interview Questions

JSP
how can we use beans in jsp  how can we use beans in jsp   JSP provides three tags to work with beans:- <jsp:useBean id="bean name... = the name that refers to the bean.Bean class = name of the java class 

JSP Servlet Questions

Tomcat error - JSP-Servlet
the error :-this is non microsoft product please see event log . what might be the reason of such error  HI, Can you paste the error log here.We will analyze and try to provide the solution. Have you installed Java on your computer 

Programming Tutorials

JSP Error Page
JSP Error Page          JSP Error Page is used to specify the custom... directive. The page errorPage.jsp shows the error generated in calling the JSP page 

JSP Servlet Questions

Programming Error - JSP-Servlet
.  Hi Friend, Try the following code: 1)image.jsp...("http://localhost:8080/examples/jsp/modify.jsp?filename="+filename); } 2)modify.jsp: This code works fine on Internet Explorer 

Development process Questions

Jsp Error - Development process
Jsp Error  Hi, While executing Add_Data.jsp , am getting following error. "Data type mismatch in criteria expression." "View_Data.jsp...) at jsp_servlet.__add_data._jspService(__add_data.java:146 

Blog

Sitemap JSP Tutorial Section
java script in jsp | Create and use Custom error page in JSP | Custom Iterator... | JSP PDF books | Free JSP Books | Free JSP Download | Authentication... through JSP | Use Break Statement in jsp code | Use Compound Statement 

Spring Framework

Spring Security HTTP basic authentication
Spring Security HTTP basic authentication In this section, you will learn about the HTTP basic authentication in Spring Security. You can configure HTTP basic authentication in spring-security.xml as follows : <!--Spring 

JSP Servlet Questions

JSP code problem - JSP-Servlet
JSP code problem  HI.. I have a DB2 stored procedure wich return a result set. I have made a report basing on this procedure using Crystal Reports. How to pass parameters to this procedure with java code in a JSP page 

Java Beginners

jsp code - Java Beginners
jsp code  hello sir i have a problem in in loop while(itr.hasNext... to retrieve the value of staxapp when i wana use it in entire jsp. thanks   Hi Friend, Try the following code 

JSP Servlet Questions

Error in loading jsp file - JSP-Servlet
Error in loading jsp file  I did as u have said. I copied iitem.jsp...:8080/webapps/examples/jsp/iitem.jsp In both cases,it is giving the following error.../iitem.jsp If you got the error again, then send your full code. Thanks 

JSP Servlet Questions

Programming Error - JSP-Servlet
Orders Delete Orders View Orders Back Jdbc code: import...(""); } catch(SQLException se) { out.println("Database Error :"+se.getMessage()); } catch(Exception e) { out.println("General Error :"+e.getMessage 

JSP Servlet Questions

java jsp
java jsp  it is : javax.servlet.jsp only but getting error wt is reason?   Use javax.servlet.jsp.* in your code 

JSP Servlet Questions

Programming Error - JSP-Servlet
Programming Error  How to validate login page using jsp where it checks for username whether it is empty or not or is it including number... code: function isAlpha(argvalue) { argvalue = argvalue.toString 

JSP Servlet Questions

Error output - JSP-Servlet
Error output  Can anyone please assist me; The printed output should.... Can anyone trace what went wrong of my code pls...; Hi Friend, Try the following code: Do Me function Do(){ var 

JSP Servlet Questions

insertion error - JSP-Servlet
into table. below is the codeof jsp and java pages; function...insertion error  my first jsp page : In this i m getting all the values through a method called getAllDetails,the values are getting inserted 

JSP Servlet Questions

Programming Error - JSP-Servlet
Java"); //msg.setSentDate(new Date()); // Set... a " + "plain text e-mail through Java.\n...(); } } }//End of class m geeting error in this can u please tell me 

Development process Questions

Jsp error when i run this a jsp file
Jsp error when i run this a jsp file  hi I got this error when i run the jsp file in IDE and outside also please help me...) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)   Please post your code 

JSP Servlet Questions

Programming Error - JSP-Servlet
integer.parseInt but its giving error. Please Reply me . Thank you..., we have used Javascript and for another one, we have used java. 1 

JSP Servlet Questions

jsp
report message description The server encountered an internal error... api.jar file inside the lib folder. 4)Now create a jsp file:'hello.jsp' <%@page language="java"%> <%String st="Hello World"; %> Message is <%=st 

JSP Servlet Questions

code - JSP-Servlet
code  hi sir my question is i have created a html ang jsp code.... how to write the code to accept an existing id and password.  Hi Friend, Try the following code: 1)login.html: Login 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  hi, i have created a table in MYsql and connected it using JDBC, I have to now validate those fields using jsp, so please can you suggest me a way how to validate using jsp, my table has fields 

Framework Questions

jsp
jsp  when i run jsp program it shows error-500 what is that error my source code is <% page import="java.sql.*" %> <%! Connection...;/html>   It seems that there is a programming error.The Error 500 

Development process Questions

Jsp Error - Development process
Jsp Error  Hi, While executing following code "View_Service.jsp" , am getting Internal Server Error java.sql.SQLException: [Microsoft][ODBC...(JdbcOdbcStatement.java:288) at jsp_servlet.__add_data._jspService(__add_data.java:146 

General

Basic authentication
the client's built in authentication mechanism. In java programming language... Basic authentication       Basic authentication is the process through which a web server authenticates 

JSP Servlet Questions

Programming Error - JSP-Servlet
is Payment.jsp. This code is placead.jsp and from that page I want that the value inside... ??? And when i tried its giving me error than cannot find variable.In 

Java Beginners

Jsp Code - Java Beginners
Jsp Code  Hi, I am new to java programming & as per the requirement, i need to implement a 'SEARCH' functionality which will search the database & should display a unique record. The design contains the 4 input boxes 

JSP Servlet Questions

java/jsp code to download a video
java/jsp code to download a video  how can i download a video using jsp/servlet 

JSP Servlet Questions

jsp code problem - JSP-Servlet
jsp code problem  hi, I am going to execute the following code which has been given your jsp tutorial. retrive_image.jsp: but while I try to execute the code it gives the following error message in the tomcat 

JSP Servlet Questions

java code - JSP-Servlet
java code  Code to send SMS through mobile to a web application 

JSP Servlet Questions

JSP
JSP   how to open and view a flat file in browser using java code in jsp?   Hi Friend, If you want to simply open a file then try the following code: <%@page import="java.util.*"%> <% Runtime rt 

JSP Servlet Questions

java code - JSP-Servlet
java code  hi i have made an application in which i have a fuctionality. in which i get the location of xml files as links on jsp page and when they are clicked .they opn in xml format..it works fine when i run the server 

Java Beginners

JSP Code - Java Beginners
JSP Code  Hi Frnds, I am using a checkbox in my one of page & which is by default checked. Now if i have to use the status of this checkbox... Rai  Hi Friend, Try the following code: 1)checkbox.jsp 

Development process Questions

Error in Jsp - Development process
Error in Jsp  Hi Friends, For the following code when i include src in script Sub-Combo box is not working . but if i remove src then it will work. Add Data var arr = new Array(); arr["Select"] = new Array 

JDBC Questions

JDbc Login Authentication
JDbc Login Authentication  Pease Please.. Send Me one Login Authentication Using ComboBox.From Servlet and jsp with sessions I am new to sessions... the following link: http://www.roseindia.net/jsp/loginbean.shtml 

JSP Servlet Questions

Programming error - JSP-Servlet
where if @ is not given or (dot). is not given etc then it should display error... the following code: 1)modify.jsp: Place Order function 

Java Beginners

JSP Code - Java Beginners
JSP Code  Dear Frnds, I m using a 'multiple selecttion in List box' & trying to get all the value selected in list box. Here is the line which i... Vinay Kumar Rai   Hi Friend, Try the following code: 1 

Swing AWT

Authentication of password - Swing AWT
Authentication of password  System level authentication of password..., I am sending running code, please implement this code. import... String: " + inputStr); System.out.println("Encrypt code: " + str1 

JSP Servlet Questions

Programming error - JSP-Servlet
Programming error  Hello Sir, Can u please reply me the code for javamail please actually i watch the javamail.net but i dint understood... Reply me ?? the code. Thank You Sir.   Hi Friend, Please visit 

Java Beginners

JSP Code - Java Beginners
JSP Code  Hi frnds, This is reference to solution which u have provided for 'Limiting the Number of Record Display in a table'. With full...: Pagination of JSP page Roll No Name Marks Grade 

JSP Servlet Questions

JSP
JSP  I am now using MySql database i have one error when connectivity code run that is ... driver not found I want to get driver or driver class or Plz know me that which class i have to use Like 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  i want to do client side validations using JSP, so please can u suggest me a way out.thanq very much for the previous answers... validations.........u will find some js files download that and include i the jsp 

Java Beginners

JSP Code - Java Beginners
JSP Code  Dear frnds, I have a problem where i need to display...;Hi Friend, Try the following code: function city(){ var cid...:8080/examples/jsp/country.jsp?value="+val); } --Please Select-- "> 

JSP Servlet Questions

Programming Error - JSP-Servlet
in this code because, i want that when user types something in draftad it should count..., Try the following code: function Draft(text1,text2){ var v1=text1.value 

Java Beginners

http Client Authentication
http Client Authentication  hi friends, i am trying a java API... authentication problem. can any one please help me to solve this problem. please... ); System.out.println("\n Response status code: " + statusCode); // Display response 

Advertisements Advertisements
 

 

 

DMCA.com