• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rui Ferns
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic