[ Team LiB ] Previous Section Next Section

Q&A

Q1:

Why do I get a ClassNotFoundException when I try to use the ShoppingCart class?

A1:

The JSP engine probably can't see the class in its classpath. Tomcat uses the system classpath, so if ShoppingCart.class is visible somewhere in the system classpath, they should see it.

Q2:

I changed one of the shopping cart classes; why don't any of the servlets or JSPs show the change?

A2:

Unless you use the Tomcat Manager, it's possible that the classes are not reloaded automatically. You must restart the JSP/servlet engine to pick up changes in other classes. Tomcat does provide an option to reload servlets without restarting. To do this, you can add the attribute reloadable=true to a Context component in server.xml. Tomcat will automatically reload classes if a new war file is dropped into the webapps directory or in a few other cases. See the Tomcat documentation for details.

Q3:

I stored a cookie on the browser; why can't I see it?

A3:

First, check to make sure you spelled the cookie name correctly. Next, make sure the browser has cookies enabled. Also, if you specified a root path for the cookie, make sure that the JSP or servlet reading the cookie is in that path. Remember, too, that if you don't give the cookie a specific expiration time, the cookie will vanish when the user shuts the browser down.


    [ Team LiB ] Previous Section Next Section