Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts examples using mysql like loginscreen  RSS feed

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

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" />
<% } %>

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!