• Post Reply Bookmark Topic Watch Topic
  • New Topic

Validate userid and password  RSS feed

 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need to validate my user id and password that was in jsp, for validation what technique i can use like servlet or struts. iam new to developing side please guide me.

Now iam developing login page by jsp in my-eclipse with tomcat please guide me if i want to use servlet means how and where i want to store the files and if struts what are the jar files i want to download.


Thanks in advance.
Jenifer Rajkumar
 
Swastik Dey
Rancher
Posts: 1812
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your jsp file should be under WebContent folder and java source files(e.g. servlet) should go under Java Resources.
 
Palash Nandi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi jenifer,
There is no fixed rule regarding what you need to use. It all depends on how you validate the userid and password. Since you are new to jsp , I would suggest you not to use struts as it will make it unnecessarily complex. You can use simple jsp or Java classes for validation.

Some basic guidelines:
1. Use a basic html page for userid and password and put it in a <form> tag. let the action of the form tag point to a validate.jsp( the name can be anything ) file.
2. inside the validate.jsp , you can retrieve the previous useris/password using "request.getParameter('userName')" and password similarly.
3. Then you can pass this to a java method in your java class where you can write the logic for validating it. You can simpley hardcode the logic or if you haave a database , retrieve the data from there and validate.
4. According to the returned value you can do a simple out.println("success") or failure on the jsp.

Once you get this running, you can go on and make it more complex. Since you are new, i would not advise you to start with struts with packages as they do a lot of things for you. Which may look good in the start, but once you get stuck, it will be a nightmare.

So best of luck!!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jenifer Rajkumar,
Your post was moved to a new topic. Please be sure to start new topics for new questions.
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Palash Nandi wrote:
2. inside the validate.jsp , you can retrieve the previous useris/password using "request.getParameter('userName')" and password similarly.


I would not advice a beginner to do this. You should not write Java code inside JSP, start with good programming habits.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A thousand times yes. No Java in a JSP. Ever.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!