Share on Google+Share on Google+

1 Answer(s)      7 years ago
Posted in : Java Beginners
I want to develop a small web application using netbeans.It contains a user login page,after sign into the page it will shows a new panel.

Plese send me links which contains theory and practical information.


View Answers

February 9, 2010 at 1:29 PM

Hi Friend,

Try the following code:


<form name="form" method="post" action="../Authenticate">
<table align="center"><tr><td><h2>Login Authentication</h2></td></tr></table>
<table width="300px" align="center" style="border:1px solid #000000;background-color:#efefef;">
<tr><td colspan=2></td></tr>
<tr><td colspan=2>&nbsp;</td></tr>
<td><b>Login Name</b></td>
<td><input type="text" name="username" value=""></td>
<td><input type="password" name="password" value=""></td>

<td><input type="submit" name="Submit" value="Submit"></td>
<tr><td colspan=2>&nbsp;</td></tr>


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

public class Authenticate extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException{
PrintWriter out = response.getWriter();
String user=request.getParameter("username");
String pass=request.getParameter("password");
String user1="";
String pass1="";
HttpSession session = request.getSession(true);
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root";);
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login where username='"+user+"' and password='"+pass+"'");
user1 = rs.getString("username");
pass1 = rs.getString("password");
catch(Exception e){}

String user = session.getAttribute("username").toString();
Welcome <%out.println(user);%>
<a href="#">Add</a><br>
<a href="#">Edit</a><br>
<a href="#">Delete</a>


Related Tutorials/Questions & Answers:
web interface
web interface  hii sir, i want to develop a project name web GU interface for oracle like 10g can anyone help me plz how to develop using jsp and servelets provide code for WOI
reain values
reain values  Sir I have Jsp page for regisering customers,when i submit form it goes to servlet in servelets it checks for the username if it already exits i m using reuest.sendredirect to same jsp but all textbox values
Servlet Tutorials for Beginners
for a developer to learn Servlets to create dynamic web applications as Servelets
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? file location SASLError using PLAIN: not-authorized


Advertisement null