User: janaudy
Date: 00/09/15 09:08:31
Modified: webstore/src/org/jboss/zol/webstore/servlets
CreateAccountServlet.java LoginServlet.java
Log:
Bugs fixed with the login in the HTTPSession.
Revision Changes Path
1.3 +17 -12
zola/webstore/src/org/jboss/zol/webstore/servlets/CreateAccountServlet.java
Index: CreateAccountServlet.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/servlets/CreateAccountServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CreateAccountServlet.java 2000/05/22 17:03:43 1.2
+++ CreateAccountServlet.java 2000/09/15 16:08:30 1.3
@@ -7,7 +7,7 @@
* @author Thierry Janaudy
* @date April 18th, 2000
*/
-
+
import javax.servlet.http.*;
import javax.servlet.*;
@@ -32,7 +32,7 @@
public void init(ServletConfig sc) throws ServletException {
super.init(sc);
}
-
+
/**
* doPost
* @param req
@@ -41,7 +41,7 @@
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws java.io.IOException {
HttpSession session = req.getSession(true);
-
+
String email = req.getParameter("EMAIL");
String firstname = req.getParameter("FIRSTNAME");
String lastname = req.getParameter("LASTNAME");
@@ -54,7 +54,7 @@
String city = req.getParameter("CITY");
String country = req.getParameter("COUNTRY");
String lang = req.getParameter("LANGUAGE");
-
+
Locale locale = null;
int val = Integer.parseInt(lang.substring(0, 1));
switch(val) {
@@ -67,14 +67,17 @@
case 3:
locale = Locale.GERMAN;
break;
+ case 4:
+ locale = I18NManager.FINNISH;
+ break;
default:
- locale = Locale.ENGLISH;
+ locale = Locale.ENGLISH;
}
-
+
System.err.println(email+" "+firstname+" "+lastname+" "+password1+
" "+password2+" "+visa+" "+address+" "+street+" "+
zipcode+" "+city+" "+country+" and Locale "+locale);
-
+
PersonEntityHome pehome = null;
try {
/**
@@ -93,9 +96,9 @@
e.printStackTrace();
}
}
-
+
System.err.println("pe home obtained "+pehome);
-
+
PersonEntity pe = null;
String pk = new String(email);
try {
@@ -116,6 +119,8 @@
pe.setCountry(country);
pe.setLocale(locale);
session.setAttribute("zol.login", pk);
+ session.setAttribute("zol.firstname", firstname);
+ session.setAttribute("zol.locale", locale);
} catch (Exception fe) {
fe.printStackTrace();
System.err.println("Exception. Should forward to create page...");
@@ -129,11 +134,11 @@
e.printStackTrace();
}
}
-
+
System.err.println("pe created: "+pe);
-
+
ServletOutputStream sos = res.getOutputStream();
-
+
sos.println("<HTML><BODY>");
sos.println(I18NManager.getString("zol.account.create.success", locale) +
"<BR>");
sos.println("<A HREF=\"/zol/main.jsp\">"+
1.2 +7 -7
zola/webstore/src/org/jboss/zol/webstore/servlets/LoginServlet.java
Index: LoginServlet.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/servlets/LoginServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoginServlet.java 2000/05/10 14:49:13 1.1
+++ LoginServlet.java 2000/09/15 16:08:30 1.2
@@ -51,7 +51,7 @@
String login = req.getParameter("LOGIN");
String paswd = req.getParameter("PASSWORD");
-
+
System.err.println("______________________________________________");
System.err.println("Login: "+login+", password: "+paswd);
@@ -61,7 +61,7 @@
pehome = (PersonEntityHome)MyNarrow.narrow(pO, PersonEntityHome.class);
System.err.println("[pehome]="+pehome);
} catch (Exception e1) {
- e1.printStackTrace();
+ //e1.printStackTrace();
String ep = "/error/lookup_error.jsp";
try {
forwardRequestTo(ep, req, res);
@@ -78,7 +78,7 @@
pe = (PersonEntity) MyNarrow.narrow(pehome.findByPrimaryKey(pk),
PersonEntity.class);
} catch (Exception fe) {
- fe.printStackTrace();
+ //fe.printStackTrace();
System.err.println("Exception. Should forward to create page...");
session.setAttribute("zol.login", pk);
String ep = "/createaccount.jsp";
@@ -99,7 +99,7 @@
System.err.println("pe = "+pe);
pePaswd = pe.getPassword();
} catch (Exception e3) {
- e3.printStackTrace();
+ //e3.printStackTrace();
String ep = "/error/lookup_error.jsp";
try {
forwardRequestTo(ep, req, res);
@@ -108,7 +108,7 @@
e.printStackTrace();
}
}
-
+
System.err.println("=============================================!!");
if (paswd.equals(pePaswd)) {
System.err.println("success, put the right stuff in the session object");
@@ -120,7 +120,7 @@
session.setAttribute("zol.locale", locale);
session.setAttribute("zol.password.correct", new Boolean(true));
session.setAttribute("zol.account.create", new Boolean(false));
-
+
try {
System.err.println("success, forwarding to zol.jsp targeted _top");
forwardRequestTo("/imforward.jsp", req, res);
@@ -139,7 +139,7 @@
}
}
}
-
+
String ep = "/main.jsp";
session.setAttribute("zol.password.correct", new Boolean(false));
try {