ajith
java+jsp
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners

View Answers

July 25, 2008 at 7:00 PM


Hi friend,

<%@ page language="java" %>
Please enter your Name and Password here:
<br>
<br>
<form name="frm" action="/JSPMultipleForms/Authentication" method="Post" >
Name:&nbsp;&nbsp;&nbsp;<input type="text" name="user" value=""/>
Password:<input type="text" name="pass" value=""/>
&nbsp;&nbsp;&nbsp;<input type="submit" value="Check" />
</form>


---------------------------------

java file

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://192.168.10.59/messagepaging";;
Connection connection=null;
ResultSet rs;
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");
}
rs.close ();
s.close ();
}catch(Exception e){
System.out.println("Exception is ;"+e);
}
if(userName.equals(request.getParameter("user")) &&
passwrd.equals(request.getParameter("pass"))){
out.println("User Authenticated");
}
else{
out.println("You are not an authentic person");
}
}
}
-------------------------------------------------------

Read for more information.

http://www.roseindia.net/jsp/

Thanks









Related Pages:
JAVA,JSP,SERVELTS
JAVA,JSP,SERVELTS  plz Send me Login Page by using core java ,Jsp,Servelts
java jsp
java jsp  please I want code to parse a web page using Dom parser, thanks
Java jsp
Java jsp  What is JSP
java jsp
java jsp  it is : javax.servlet.jsp only but getting error wt is reason?   Use javax.servlet.jsp.* in your code
java/jsp
java/jsp  In a JSP program called books.jsp, the Java code out.print(request.getParameter(â??numberâ??)); displays "1111111â??. What are the possible ways for the parameter number to have got its value
Java - JSP-Servlet
Java  Dear Deepak, In my Project we need to integrate Outlook Express mailing system with java/jsp. thanks & regards, vijayababu.m
Java - JSP-Servlet
Java, JSP vs Servlet  If anyone have idea about how to use all these technologies in one project ..please share with me. Thanks
Java - JSP-Servlet
Java  Hi All, How to integrate Outlook Express with java/jsp. Plase any one help me. thanks®ards, vijayababu.m  Hi Friend, Use the following: Send Mail Thanks
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have been given an assignment where I have to fix existing issues in the tool(created using JAVA JSP). e.g. Tool does not adjust with the resolution of the screen
java/jsp code to download a video
java/jsp code to download a video  how can i download a video using jsp/servlet
JAVA JSP and Servlet - JSP-Servlet
JAVA JSP and Servlet  for sending mail through lan without intenet and also chatting facility for online users using Java JSP & SERVLET code.  Hi Friend, Please visit the following links: http://www.roseindia.net
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
Java and JSP help
Java and JSP help  I have a website, on my website i have made a form...;title>JSP Form</title> <style> </style>...="myPackage.FileReaderWriter"%> <%@page import="java.util.Vector"%> <%@ page language="java
java - JSP-Interview Questions
java  1. why implicit object "Exception" is difference from other implicit objects? 2. what is the meaning of exception page & exception in jsp directive
java - JSP-Servlet
java  selected strings clicks right arrow goto shows in another listbox and as it is stored into table type to the next jsp page
JAVA - JSP-Servlet
Java servlets sessions session tracking  How to track the session in Servlet
tasks on java - JSP-Servlet
tasks on java  hi all, i am a beginner in java language ,i would like to practice some tasks in java..i have an idea about servlets, how to write code .so please can anyone forward a site which contains tasks on java
java - JSP-Servlet
java  hi friends plz give basic information about Taglibraries,Jstl,CoustamTags with ex?   Hi friend, Read for more information. http://www.roseindia.net/jsp/ amardeep  
JAVA - JSP-Servlet
JAVA  IN JSP NEXT,DELETE,SAVE,CANCEL,PREVIOUS BUTTON CODES,  Hi Friend, Try the following code: ID Name Address Contact
java - JSP-Servlet
java  Hi......I want the java projects and source code of it and explanation for the projects can any one help me outt....and also suggest me where to do the projects to get real time exp ....hope some one will help mee...mail
java - JSP-Servlet
java  how to upload a pdf file in a jsp page using servlet
java - JSP-Servlet
Java Servlet Config means   What is Servlet Config means ?  ServletContext and ServletConfig Tutorials And Example CodeServletConfighttp://www.roseindia.net/servlets/MethodsOfServlets.shtmlServletContexthttp
java - JSP-Servlet
java  I have to make a JSP PAGE where i have to collect the data from database and give the different format to different columns from different rows for example suppose i have database having records like Section SubSection
java - JSP-Servlet
java  SORRY!!!! Ihave posted the wrong question. correct one is- how to get the path of uploaded files on the server using java servlets   Hi, How you are uploading the file on the server. Actually I am trying
Java - JSP-Servlet
I asked the question that how to load JSP in my website, Actually I am working here on JSp to publish the result of my college online so I want to write JSP so where do store my JSP in website. I will be greate full toyou if you kindly
program of java - JSP-Servlet
program of java  hi friends... i hv faced a problem of jsp code.my problem is... i want to extract data from dropdown menu to the next jsp page..... and also i want to generate a serial no and with this serial no , i want
java - JSP-Servlet
from jsp? 2. jsp get translated to servlet.where can find the servlet class (generetted from jsp)for tomcat?  Hi Friend, 1)It extends...\apache\jsp\jsp Thanks
java - JSP-Servlet
java  can u send me an example of jsp plugin action to illustrate that how the applet is embeded into this plugin  Hi friend, I am... information. http://www.roseindia.net/jsp/applet-jsp.shtml Thanks

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.