Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts examples using mysql like loginscreen

 
sherin pooja
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 sherin_rakin@yahoo.co.in

Index.jsp
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">

admincheck.jsp
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection
("Jdbc:mysql://localhost:3306/domaininform","root","");
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);
while(rs.next())
{
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" />
</jsp:forward>
<% } %>

bye
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic