Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2006, 07:32 AM
Registered User
 
Join Date: Apr 2006
Location: madurai, tamil nadu, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mill3prog7@yahoo.co.in
Default login screen in struts and mysql database

This coding is used for only jsp page like login screen. Now i want to use this coding in struts and mysql. will u please help how can i use this coding in struts. please help me and give me the sample coding. i know struts but i don't know exactly how to send jsp text box values in action form, action page and database. please help me.

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:param name="errMsg"
value="Sorry Your UserName and Password is Mismatch" />
</jsp:forward>
<% } %>


Sheik dawood
 
Old May 4th, 2006, 09:07 AM
Authorized User
 
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default

Hey Sheik ,

you are asking lot of things in the first go itself.
check out the following step
1) create action file shift the code of the adminCheck.jsp in it.
2) map this action file against the call in the struts-config.xml file.
3) also add the forwards to the index.jsp and errorpage.jsp for the action.
4) in the index.jsp, submit the form to this action mapping.

make sure the entries are proper and thats it. This will be ready for the struts framework. THis is very basic level you need to do lot other things to make this perfect in struts.
4)

---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent help - Customized Windows login Screen Rehanrana Visual C++ 1 December 27th, 2007 03:48 AM
Login Screen shahidr100 Pro VB Databases 13 April 3rd, 2007 02:24 AM
Login Screen ashes0000 Word VBA 1 December 29th, 2006 03:00 AM
making login case sensitive with mysql database crmpicco MySQL 0 August 18th, 2006 05:48 AM
Having trouble with a recordset for Login screen wayne62682 Access VBA 3 March 28th, 2006 09:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.