2 17318 nathj 938
Recognized Expert Contributor
Hi,
Forgive my ignorance here but I'll try to help as best I can.
When I ahve tried to do this I have used Struts and the combination of the web.xml file and the struts-config.xml has anabled me to achieve exactly what you are looking for.
Have a read around Apache Struts and try out some of the examples. I'm sure you'll be up and running soon.
Cheers
nathj
I got the Result(output).
Thanks for keeping me in ur mind.
Thanks.,Thanks for ur help..,
my programs are coming below..,
AuthenticationLogin.jsp -
<%@ page language="java" %>
-
<html>
-
<head>
-
<title>Login Page</title>
-
<script language = "Javascript">
-
function Validate(){
-
var user=document.frm.user
-
var pass=document.frm.pass
-
-
if ((user.value==null)||(user.value=="")){
-
alert("Please Enter user name")
-
user.focus()
-
return false
-
}
-
if ((pass.value==null)||(pass.value=="")){
-
alert("Please Enter password")
-
pass.focus()
-
return false
-
}
-
return true
-
}
-
</script>
-
-
<body bgcolor="White">
-
-
<!--<div align="center"><h2>Project Master!-->
-
<br>
-
</h1>
-
<title>Master</title>
-
<style rel="stylesheet" type="text/css" media="screen">
-
form
-
{
-
margin: 6px auto;
-
width: 75%;
-
}
-
</style>
-
</head>
-
<form name="frm" action="/NewForm/LoginAuthentication" method="Post" onSubmit="return Validate()" >
-
<div align="center">
-
<table border='0' cellpadding="10" colspan="5" height="400" width="850" text='black' bgcolor="white">
-
<tr><th colspan="5"><font color="DarkBlue"><h1><img src='report.png' width='250' height='150' border='0'><th></tr>
-
-
<tr> <td></td><td></td><td><img src="distillogo.png" width="250" height="50" border="0"><br> <img src="layer8.png" width="250" height="50" border="0"></td><td><br>
-
<img src="usernamecopy.png" width="75" height="12" border="0"> <input type="text" name="user" value=""/><br><br>
-
<img src="passwordcopy.png" width="70" height="12" border="0"> <input type="password" name="pass" value=""/><br>
-
<br> <input type="submit" value="Sign-In" />
-
<input type="reset" value="Reset" />
-
</td></tr>
-
<tr><td></td></tr>
-
</form>
-
</body>
-
</html>
-
LoginAuthentication.java -
import java.io.*;
-
import java.util.*;
-
import java.sql.*;
-
import javax.servlet.*;
-
import javax.servlet.http.*;
-
-
public class LoginAuthentication 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();
-
Connection connection=null;
-
ResultSet rs;
-
String userName= request.getParameter("user");
-
String passwrd= request.getParameter("pass");
-
-
-
response.setContentType("text/html");
-
try {
-
// Load the database driver
-
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
-
// Get a Connection to the database
-
connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","username","password");
-
-
//Add the data into the database
-
String sql = "select dil_username,dil_password from dil_Register where dil_username = '"+userName+"' AND dil_password='"+passwrd+"' ";
-
Statement s = connection.createStatement();
-
//s.executeQuery (sql);
-
-
//rs = s.getResultSet();
-
rs=s.executeQuery (sql);
-
if(userName.equals("vh") && passwrd.equals("vh123")){
-
-
if (rs.next ()){
-
-
out.println("<html>");
-
out.println("<head>");
-
out.println("<title>Master</title>");
-
out.println("<style rel='stylesheet' type='text/css' media='screen'> form { margin: 000.1em auto; width: 75%; } </style>");
-
out.println("</head> <body bgcolor='White'> <a href='http://localhost:8085/NewForm/Form1.jsp'>ProjectMaster</a>\t\t<a href='http://localhost:8085/NewForm/ListDB.jsp'>List</a> <div align='center'><img src='logo.png' width='100' height='30' border='0'>");
-
out.println("<div align='right'> Welcome\t"+userName+",\t<a href='http://localhost:8085/NewForm/AuthenticLogin.jsp'>Logout</a>");
-
out.println("<U>");
-
out.println("<form>");
-
out.println("<table cellspacing='75' cellpadding='10' border='0' height='500' width='1000' text='black' colspan='4' bgcolor='white'>");
-
out.println("<tr><td><img src='logo.png' width='250' height='50' border='0'><br> <img src='layer8.png' width='250' height='50' border='0'></td>");
-
out.println("<td><font color='Black' size='2'><p>\t\tAs an organization, putting together a reporting and Business Intelligence solution is among the most important decisions a company makes. And making a valid business case for such a project is the stuff CIO nightmares are made of.</p>");
-
out.println("<p align='justify'>\t\tWalking the fine line between plain vanilla reporting and the high end statistical data analysis to bring forth value and business benefits from a staged approach to data management and analysis leading to information management is usually the success mantra in these initiatives.Distil BI and its inherent capabilities allow easier appreciation of the many intangibles you’ll find hard to articulate and justify in such projects. </p></td>");
-
out.println("</tr> </table> </form> </body> </html>");
-
-
}
-
}
-
else{
-
out.println("<html>");
-
out.println("<head>");
-
out.println("<title>Master</title>");
-
out.println("<style rel='stylesheet' type='text/css' media='screen'> form { margin: 000.1em auto; width: 75%; } </style>");
-
out.println("</head> <body bgcolor='White'> <a href='http://localhost:8085/NewForm/TimeForm.jsp'>Time Log</a> <div align='center'><img src='logo.png' width='100' height='30' border='0'>");
-
out.println("<div align='right'> Welcome\t"+userName+",\t<a href='http://localhost:8085/NewForm/AuthenticLogin.jsp'>Logout</a>");
-
out.println("<form>");
-
out.println("<table cellspacing='75' cellpadding='10' border='0' height='500' width='1000' text='black' colspan='4' bgcolor='white'>");
-
out.println("<tr><td><img src='logo.png' width='250' height='50' border='0'><br> <img src='layer8.png' width='250' height='50' border='0'></td>");
-
out.println("<td><font color='Black' size='2'><p>\t\tAs an organization, putting together a reporting and Business Intelligence solution is among the most important decisions a company makes. And making a valid business case for such a project is the stuff CIO nightmares are made of.</p>");
-
out.println("<p align='justify'>\t\tWalking the fine line between plain vanilla reporting and the high end statistical data analysis to bring forth value and business benefits from a staged approach to data management and analysis leading to information management is usually the success mantra in these initiatives.Distil BI and its inherent capabilities allow easier appreciation of the many intangibles you’ll find hard to articulate and justify in such projects. </p></td>");
-
out.println("</tr> </table> </form> </body> </html>");
-
//out.println("Please enter correct username and password");
-
//out.println("<a href='AuthenticLogin.jsp'><br>Login again</a>");
-
}
-
-
//rs.close ();
-
s.close ();
-
}catch(Exception e){
-
System.out.println("Exception is ;"+e);
-
}
-
}
-
}
-
-
web.xml -
<?xml version="1.0" encoding="ISO-8859-1"?>
-
-
<!DOCTYPE web-app
-
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-
"http://java.sun.com/dtd/web-app_2_3.dtd">
-
-
<web-app>
-
<servlet>
-
<servlet-name>LoginAuthentication</servlet-name>
-
<servlet-class>LoginAuthentication</servlet-class>
-
</servlet>
-
<servlet-mapping>
-
<servlet-name>LoginAuthentication</servlet-name>
-
<url-pattern>/LoginAuthentication</url-pattern>
-
</servlet-mapping>
-
</web-app>
-
i'm very Happy for having such a lovely friend like U.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: BUX |
last post by:
I have to call Forms!myForm.myControl_AfterUpdate using
myString = "Forms!myForm.myControl_AfterUpdate".
I have tried with
Application.Run myString
Call myString
eval myString
|
by: David N |
last post by:
Hi All,
I just wonder if in C#, I can develop a user defined control that can call
its parent function which is not yet developed. For example, how do I make
my user control call a...
|
by: Steven C |
last post by:
Hello:
I've seen several recent threads on this, but I'm still not clear how
to reference a *method* on one form from another. I want to add a
customer in the child form, and then update the...
|
by: Aaron Ackerman |
last post by:
I have a form that I need to call that is in it's own project in the SAME
solution and I am at a loss.
So what I am trying to do is call Form1 in Project 1 from Form2 in Project2.
How do I do...
|
by: Robert Gage |
last post by:
Hello All
Can anyone tell me in a single solution how to call a form in another
project?
I have a large solution made up of several projects and need to call back
and forth betweem them
TIA
|
by: khokimfang |
last post by:
Hi All,
I want to ask how to call form with only one variable in VB.Net.
I have 3 form (Form1, Form2 and Form3) and 1 module.
in the module i want to declare public variable to call form for ex:...
|
by: Eric |
last post by:
Hi: Is it possible i call access form in browser.
Thanks,
|
by: abhijitkonwar |
last post by:
how can i call a form from another form? please help!!
|
by: senthilkumarb |
last post by:
How can i call a function automatically when the server started ?
|
by: varunbhatia87 |
last post by:
I am developing an application in vb.net, in which i m using a treeview control which display nodes generated from database, when i select a node it gives me a form name that comes also from...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |