This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes need help with design of a Login page in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "need help with design of a Login page in JSP" Watch "need help with design of a Login page in JSP" New topic
Author

need help with design of a Login page in JSP

medhaj hambi
Ranch Hand

Joined: Jun 04, 2008
Posts: 34
Hi ranchers, I am new to JSP and I am interested in creating a user register, login feature using JSP. Also, I am interested in adding a forgot password link so that I should be able to send the users their passwords to their respective email addresses that they provide. I am thinking of using JSP and mysql for storing the users in the data base.
I am not quite sure as to how to implement that. Can you guys please shed some light as to how to implement the thing ???
I would appreicate that if you could provide me some sort of an architecture so that I can go ahead in implemetning that.
I really appreciate that guys. Thanks a lot.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

We're not going to design it for you, what have you thought of so far?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
medhaj hambi
Ranch Hand

Joined: Jun 04, 2008
Posts: 34
Ahem...my intention was NOT to ask you to design the entire thing for me, if that is was you understood from my query. I apolozise for not making my self clear. Any ways, this is the design that I came up with. If there are any glitches that I need to look upto , pl do let me know.
I would appreciate that if you could be KIND ENOUGH to validate the design.
No pun intented.

1. Add a link to create profile, user. password and possibly email.
this means you create a table with the following columns.
user
password
emails (Can be primary key)

2. provide a form with text box for the three attributes.

3. when the user hist create profile, the backed logic should extract the the three values and do:
A. if the emails is not already in the the table, insert a new row
B. If it is in the table, send an appropriate message telling the user that this emails already exists.

4. For the user password reminder link, the user must input his/her emails and then:
A. look for the email in the table and send the user/password if it is there.
B. Send "email not found method" other wise.


The programming/design work needed:
create the user table.
write the sql statements. to insert, select and update the table.
write html/jsp code for the the input forms and extract the values.
write code to send an email with the user/password
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Sounds like a plan.

Except for using the email as a primary key. Bad idea. I always use a sequence as a primary key and never a business value.
medhaj hambi
Ranch Hand

Joined: Jun 04, 2008
Posts: 34
Sequence as in ??? Are you refering to the Index values within the table created for the user profiles ???
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

A unique value that is meaningless and just serves as a primary key.

As a PostgreSQL user, a sequence serves nicely. Other DBs have other means of generating unique keys.

In any case, using a business value as a primary key leads to disaster and disgrace.
medhaj hambi
Ranch Hand

Joined: Jun 04, 2008
Posts: 34
Hello everyone, I was trying to run the applciation based on the above design but I am kind of stuck at this point.
I have created a HTML for with three text box inputs ...lets say...test1.html is the file...and the "action" tag refers to the test01.jsp page that I will be refering to in a minute.
I have written code for extracting the values from the form and at the same , I am cross-checking the "email" field with that of the values in the table which was created by me. If the email has been found, I am asking to print a mesage saying "email already exists" else...insertt a new row with the values being extracted above. I hope I am clear enough. Here's my question though. While I was trying to test run the app, I was getting the following error.
Pl note that I have tried a test run to create a DB table and it ran well some how without any errors...but in this programe, I donot understand why I was getting these errors. I would appreciate it if you can help me understand this . Thanks a lot.


Jul 18, 2009 5:04:50 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:newjspproject' did not find a matching property.
Jul 18, 2009 5:04:50 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_13\bin;C:\Program Files\SAS\SharedFiles\Formats
Jul 18, 2009 5:04:50 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 18, 2009 5:04:50 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1129 ms
Jul 18, 2009 5:04:50 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 18, 2009 5:04:50 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Jul 18, 2009 5:04:51 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 18, 2009 5:04:51 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 18, 2009 5:04:51 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
Jul 18, 2009 5:04:51 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 950 ms
Jul 18, 2009 5:05:03 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Jul 18, 2009 5:07:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Jul 18, 2009 5:15:42 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Jul 18, 2009 5:17:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
..........
......
...... d list goes on........
medhaj hambi
Ranch Hand

Joined: Jun 04, 2008
Posts: 34
Also, I forgot to mention ...I get this error when I try to run the HTTP page...

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.test2_jsp._jspService(test2_jsp.java:115)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.apache.jsp.test2_jsp._jspService(test2_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with design of a Login page in JSP
 
Similar Threads
How to provide willdcard search
Java and LDAP directory
My Implementation of Login and Registration Module
Extending Struts Tags
Tough authentication question?