aspose file tools*
The moose likes Servlets and the fly likes How to create a package and use it with JSP's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to create a package and use it with JSP Watch "How to create a package and use it with JSP New topic
Author

How to create a package and use it with JSP's

Rui Ferns
Greenhorn

Joined: May 06, 2001
Posts: 24
Hi all,
I want to write a few classes for my shopping cart.
I will have a Item.java,Billing.java,Shipping.java and a ShoppingCart.java.
I have a main DisplayShoppingCart.jsp file that will use those classes.
Can someone tell me how to create a package containing all my class files and where to put this package so the jsp file knows where to get them.
Also do I have to change my classpath?
I tried creating a subfolder in the folder which contains my jsp files and naing it cart. I placed all my class files in there and used the :
<%@ page import="cart.*"%> but It did'nt work.
What am i doing wrong?
Should I be putting my class files in the WEB-Inf/classes folder?
Any help would be appreciated.
Thanks Rui
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
Since JSPs get turned into servlets, all support classes have to be treated just like servlet classes. Therefore they have to go in the WEB-INF\classes.
You should not have to do anything to Classpath since the servlet engine has its own rules about finding classes.
Bill

------------------
author of:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to create a package and use it with JSP's