• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to write the pgm for validating user?  RSS feed

 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ..i m beginner of jsp and servlets can any one please provide the code of program which should validate the user ... if he is valid user then in page we should get valid user message otherwise error message....please provide html file also
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What constitutes a"valid user"? What do you have so far?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show your effort first ! Its looks like a homework problem,

How much know about JSP/Servlets, What have you done till now ?
Post your code and problems , and we help you to solve it .

To start with , here is the short steps to begin with :

1 .Make a JSP/HTML page, with text input field
2. In action servlet , validate the user and redirect to desired page


Try it ,
 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its my html file
<html>
<body>
<p><p>
Enter the username and password.
<p><p>
<form method="post" action="Validate.jsp">
<center>Name: <input Name="Name" type="text"></center>
<center>Password: <input Password="Password" type="text"></center>

<p><p>
<center><input type="submit"></center>
</form>
</body>
</html>
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<form method="post" action="Validate.jsp">


Here you want to validate the user name and password in validate.jsp page, but I suggest you to write down a simple servlet with doPost method, which extracts the the form field with request#getParameter("form-field-name") ,

and you can validate against some hard coded values or from database ,

see this link for simple example for processing form !!

hope this helps !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!