A little much for a jsp page, I'd factor this into a
class. However, change this to:
try
{
Cart cart = (Cart) pageContext.getAttribute("cart",
PageContext.SESSION_SCOPE);
if (cart == null) {
cart = new Cart();
pageContext.setAttribute("cart", cart,
PageContext.SESSION_SCOPE);
}
String email = null;
String password = null;
Cookie cook;
Customer customer = (Customer)
pageContext.getAttribute("customer",
PageContext.SESSION_SCOPE);
if (customer == null) {
Cookie[] cookies = request.getCookies();
BASE64Decoder dec = new BASE64Decoder();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
if
(cookies[i].getName().equals("bfgUsername")) {
email = new
String(dec.decodeBuffer(cookies[i].getValue()));
}
if
(cookies[i].getName().equals("bfgPassword")) {
password = new
String(dec.decodeBuffer(cookies[i].getValue()));
}
}
}
if ((email != null) && (password != null)) {
Customer c = Customer.findCustomer(email);
if ((c != null) &&
(c.getPassword().equals(password))) {
c.setCart(cart);
c.fillCart();
pageContext.setAttribute("customer",c,
PageContext.SESSION_SCOPE);
}
} else {
Customer c = new Customer();
c.setCart(cart);
pageContext.setAttribute("customer", c,
PageContext.SESSION_SCOPE);
}
}
}
catch(Throwable t){
t.printStackTrace(out);
}
Now what do you get?
--- jsp <[EMAIL PROTECTED]> wrote:
> This is the page causing the error. Im getting
> warmer. Thanks for all
> the help. I think I just need to read more....
>
>
> <%@ page import="com.bfg.customer.Customer" %>
> <%@ page import="com.bfg.cart.Cart" %>
> <%@ page import="javax.servlet.http.Cookie" %>
> <%@ page import="sun.misc.BASE64Decoder" %>
>
>
> <%
> {
> Cart cart = (Cart)
> pageContext.getAttribute("cart",
> PageContext.SESSION_SCOPE);
> if (cart == null) {
> cart = new Cart();
> pageContext.setAttribute("cart", cart,
> PageContext.SESSION_SCOPE);
> }
>
> String email = null;
> String password = null;
> Cookie cook;
>
> Customer customer = (Customer)
> pageContext.getAttribute("customer",
> PageContext.SESSION_SCOPE);
> if (customer == null) {
> Cookie[] cookies = request.getCookies();
> BASE64Decoder dec = new BASE64Decoder();
> if (cookies != null) {
> for (int i = 0; i < cookies.length; i++) {
> if
> (cookies[i].getName().equals("bfgUsername")) {
> email = new
> String(dec.decodeBuffer(cookies[i].getValue()));
> }
> if
> (cookies[i].getName().equals("bfgPassword")) {
> password = new
> String(dec.decodeBuffer(cookies[i].getValue()));
> }
> }
> }
> if ((email != null) && (password != null)) {
> Customer c = Customer.findCustomer(email);
> if ((c != null) &&
> (c.getPassword().equals(password))) {
> c.setCart(cart);
> c.fillCart();
> pageContext.setAttribute("customer",c,
> PageContext.SESSION_SCOPE);
> }
> } else {
> Customer c = new Customer();
> c.setCart(cart);
> pageContext.setAttribute("customer", c,
> PageContext.SESSION_SCOPE);
> }
> }
> }
>
> %>
>
> -----Original Message-----
> From: Sean Dockery [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 04, 2003 2:59 PM
> To: Tomcat Users List
> Subject: RE: PageContextImpl.handlePageException
>
> That may not be *the* cause. It may just be a
> symptom of the cause.
> You
> should follow your root cause stack until you are
> satisfied that you
> discovered the real cause.
>
> At 15:47 2003-02-04, you wrote:
> >Hi thanks for the reply, this is the cause.
> >
> >if (pageContext != null)
> pageContext.handlePageException(t);
> >
> >Im just trying to find out whats causing this....
> thought maybe someone
> >Would have an idea besides my own incompetence.
> >
> >Thanks....
> >
> >-----Original Message-----
> >From: Sean Dockery [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, February 04, 2003 2:34 PM
> >To: Tomcat Users List
> >Subject: Re: PageContextImpl.handlePageException
> >
> >Look at line 251 in
>
>$TOMCAT_HOME/_work/appname/org/apache/jsp/index_jsp.java
> to see what
> >caused
> >the exception.
> >
> >At 14:22 2003-02-04, you wrote:
> > >root cause
> > >
> > >javax.servlet.ServletException
> > > at
> >
>
>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageConte
> >x
> > >tImpl.java:533)
> > > at
>
org.apache.jsp.index_jsp._jspService(index_jsp.java:251)
> >
> >Sean Dockery
> >[EMAIL PROTECTED]
> >Certified Java Web Component Developer
> >Certified Delphi Programmer
> >SBD Consultants
> >http://www.sbdconsultants.com
> >
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
>
> Sean Dockery
> [EMAIL PROTECTED]
> Certified Java Web Component Developer
> Certified Delphi Programmer
> SBD Consultants
> http://www.sbdconsultants.com
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]