Вы находитесь на странице: 1из 20

Issue Book Form

Figure 7.3.11

51
Return Book Form

Figure 7.3.12

52
Employee Home Form

Figure 7.3.12

53
Mail Information Form

Figure 7.3.13

54
Employee Library Form

Figure 7.3.14

55
Chat Form

Figure 7.3.15

56
Employee Leave Details Form

Figure 7.3.16

57
General Service Form

Figure 7.3.17

58
Message Post Form

Figure 7.3.18

59
View Message Form

Figure 7.3.19

60
CHAPTER 8
CONCLUSION AND FURTHER SCOPE

8.1 APPLICATION AREA

This particular software, which has been designed and developed for
WINFOCOM SOLUTIONS (P) LTD can be used in various branches. The individual
modules can be used in different application areas. So we can conclude by saying that
this software can be used as a bundle of modules or either individual modules to cater to
the needs of the perspective organization.

8.2 CONCLUSION AND FURTHER SCOPE


The system has been incorporated successfully. Appropriate care has been taken
during database design, to maintain data integrity and to avoid redundancy of data.
Validations have been done instantaneously to avoid data redundancy.

This site was developed in such a way that any further modifications needed can
be done easily. It is user-friendly and all technical complexities are hidden.

The quality factors like correctness, efficiency, usability, maintainability,


portability, accuracy, tolerance, expandability and communicatively all are successfully
done.

Future enhancements can be done further in case of the Chatting Module where a
Private Chat can be included.

61
APPENDICES

SAMPLE SOURCE CODE

Authentication.Java

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

public class Authentication extends HttpServlet


{
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String fusername=req.getParameter("username").trim();
String fpassword=req.getParameter("password").trim();
HttpSession session=req.getSession(true);
session.setAttribute("username",fusername);
out.println(fusername);
out.println(fpassword);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:intranet_test","sa","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select userid,password from
employee where userid='"+fusername+"'");

62
String tusername=null;
String tpassword=null;
while(rs.next()){
tusername=(rs.getString(1)).trim();
out.println(tusername);

tpassword=(rs.getString(2)).trim();
out.println(tpassword);
}

if((fusername.equals(tusername))&&(fpassword.equals(tpassword))){
if(fusername.equals("admin")){

res.sendRedirect("/christo/AdminHome.html");
}
else{

res.sendRedirect("/christo/EmployeeHome.html");
}
}
else{
//out.println("U R not a valid person");
res.sendRedirect("/christo/index.jsp?
message=Invalid User");
}

}
catch(Exception e)
{
out.println(e.getMessage());

63
}

}
}

Admin.Java

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

public class Authentication extends HttpServlet


{
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
IOException
{
Connection con=null;
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String fusername=req.getParameter("username").trim();
String fpassword=req.getParameter("password").trim();
HttpSession session=req.getSession(true);
session.setAttribute("username",fusername);
out.println(fusername);
out.println(fpassword);

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:intranet_test","sa","");
Statement st=con.createStatement();

64
ResultSet rs=st.executeQuery("select userid,password from employee where
userid='"+fusername+"'");
String tusername=null;
String tpassword=null;
while(rs.next())
{
tusername=(rs.getString(1)).trim();
out.println(tusername);
tpassword=(rs.getString(2)).trim();
out.println(tpassword);
}

if((fusername.equals(tusername))&&(fpassword.equals(tpassword))){
if(fusername.equals("admin")){

res.sendRedirect("/christo/AdminHome.html");
}
else
{
res.sendRedirect("/christo/EmployeeHome.html");
}
}
else{
//out.println("U R not a valid person");
res.sendRedirect("/christo/index.jsp?message=Invalid User");
}

}
catch(Exception e)
{
out.println(e.getMessage());

65
}

}
}

Chat.Java

import java.io.*;
import java.util.*;
import java.net.*;

class BroadcastClientHandler extends Thread


{
protected Socket incoming;
protected int id;
protected BufferedReader in;
protected PrintWriter out;

public BroadcastClientHandler (Socket incoming, int id)


{
this.incoming = incoming;
this.id = id;
try
{
if (incoming != null)
{
in = new BufferedReader (new InputStreamReader (
incoming.getInputStream()));
out = new PrintWriter (new OutputStreamWriter (
incoming.getOutputStream()));
}
}

66
catch (Exception e)
{
e.printStackTrace();
}
}

public synchronized void sendMessage (String msg)


{
if (out != null)
{
out.println (msg);
out.flush();
}
}

public void run ()


{
if (in != null && out != null)
{
sendMessage ("This is Winfocom Chatting");

try
{
while (true)
{
String str = in.readLine();

//System.out.println(str);

Iterator iter = server.activeClients.iterator();


while (iter.hasNext())

67
{
BroadcastClientHandler t = (BroadcastClientHandler) iter.next();
t.sendMessage (str);
}

} // end while

// incoming.close();
// this client is no longer active
// server.activeClients.remove(this);
}
catch (IOException e)
{
//e.printStackTrace();
}
} // end if
}
}
public class server //BroadcastEchoServer
{
static protected Set activeClients = new HashSet();

public static void main (String[] args)


{
int i = 1;
try
{

System.out.println("Server Started ...................");

68
System.out.println("To Stop Server Press Ctrl+c ......");

ServerSocket ss = new ServerSocket (1500);

while (true)
{
Socket s = ss.accept();
BroadcastClientHandler newClient =
new BroadcastClientHandler (s,i++);

activeClients.add(newClient);
newClient.start();
}
}
catch (Exception e)
{
//e.printStackTrace();
}
}
}

69
BIBILIOGRAPHY

BOOKS

• Thinking in Java by Bruce Echel, Edition 2001.


• The Complete Idiot’s Guide to JavaScript by Scott J.Walter and Aaron Weiss,
Edition 2000.
• Teach Yourself Java in 21 days by David Harms, Edition 2000.
• Hooked on Java by Arthur Van Hoff, Edition 1998.
• Software Engineering by Roger S. Pressman, Edition 2000.

WEBSITES

• www.freewarejava.com on 23 Aug 2004


• www.idgbooks.com on 26th Aug 2004

70

Вам также может понравиться