File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes struts examples using mysql like loginscreen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts examples using mysql like loginscreen" Watch "struts examples using mysql like loginscreen" New topic

struts examples using mysql like loginscreen

sherin pooja

Joined: Apr 20, 2006
Posts: 1
This coding is used for only jsp page like login screen. Now i want to use this coding in struts and mysql. i know struts little. I don't know exactly how to send text box values in action page, form and database. will u please help me how can i use this coding in struts. please give me coding in struts or forward my id

Admin : <input type="text" name="admin_name" size="22" value="">
Password : <input type="password" name="admin_password" size="22">
<input value="Login" name="login" type="submit" value="Login">
<input value="Cancel" name="login" type="submit" value="Cancel">

conn = DriverManager.getConnection
String admnName = request.getParameter("admin_name") ; // Get
the User Name
String admnPwd = request.getParameter("admin_password") ;
statement = conn.createStatement();
String Query = ("select * from admin " ) ;
rs = statement.executeQuery(Query);
admn = rs.getString(1);
pwd = rs.getString(2);
if( (admnName.equals(admn)) && (admnPwd.equals(pwd)))
{ %>
<jsp:forward page="selectTable.jsp?butType=normal"/>
<% } %>
<% if( (admnName != admn) && (admnPwd !=pwd ))
{ %>
<jsp:forward page="index.jsp">
<jsp aram name="errMsg"
value="Sorry Your UserName and Password is Mismatch" />
<% } %>

Don't get me started about those stupid light bulbs.
subject: struts examples using mysql like loginscreen