The following code added in java and the front end coded with HTML & JSP. Here you can download the total project and execute it with out any errors.

Code for the Login Action in Airline System.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com;

import java.sql.*;
import java.io.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LoginAction extends org.apache.struts.action.Action
{

private final static String SUCCESS = "success";
private final static String FAILURE = "failure";
public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception
{
ActionForward nextpage=null;
LoginForm lgForm = (LoginForm) form;
String uname = lgForm.getUsername();
String passwd = lgForm.getPassword();
String unam=null;
String password=null;

try {

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE","system","tiger");
System.out.println("connected");
System.out.println("lgForm.getUsername()->"+lgForm.getUsername());
System.out.println("lgForm.getpassword()->"+lgForm.getPassword());
Statement st=con.createStatement();

ResultSet rs= st.executeQuery("select username ,password from register where username ='"+uname+"'and password='"+passwd+"'");
while (rs.next()){
unam=rs.getString(1);
password =rs.getString(2);
}
}catch(Exception s)
{
System.out.println(s);
}
if(uname.equals(unam)&& passwd.equals(password)) {
nextpage= mapping.findForward(SUCCESS);

}

else{
nextpage= mapping.findForward(FAILURE);
}

return nextpage;
}

}

Download airline reservation system jsp and Java project in HTML.