Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Package does not exist�.javaBeans  RSS feed

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use javabeans. Here is what I am doing. I have a class called �Constants.java� that is in a package call db. The purpose of the class is to hold my sql strings and reset them if it is production or development (the reason being is that development does not match production exactly)
In my first jsp, �index.jsp�, I included this line�


My thinking is that I need to be able to use the getter methods of Constant anywhere in the application.

I get three errors but the first one is
Package db does not exist
db.Constant = null;
^
In my IDE I set it up the structure like this�

Application
|
|-db
| |-Constant.java
|-JRE�s
|-WEB-INF
|-index.jsp
|-blah.jsp, etc

What am I doing wrong and why?
 
Author and ninkuma
Marshal
Posts: 66789
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you compile the bean? Did you place the resulting class file in the WEB-INF/classes hierarchy?
[ February 07, 2006: Message edited by: Bear Bibeault ]
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously my reference seems to be lacking some details as they did not include the instructions you just gave. I thought these things were complied by Tomcat on startup.

No, I did not pre-compile and place in a WEB-INF/classes directory. I have since created a �classes� directory and, after deploy the war file, I copied the �Constant.class� file from it�s location at webapps/applName/db to webapps/applName/WEB-INF/classes but I still get the same problem.

Clearly I am doing something wrong. Can you give me a bit more help please?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66789
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make it

webapps/applName/WEB-INF/classes/db



This is Java. You need to maintain the package hierarchy.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah...thanks sheriffAh...thanks sheriff. I didn�t have the package moved over. It seems to work now. I have another question. I am using eclipse and the structure I presented with the post.
1)Should I just move all packages to the WEB-INF folder?
2)Is there a setting I am missing when I make a WAR file?
3)Web.xml? will this prevent me from having to do number 1?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66789
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should ask Eclipse setup questions in the IDEs forum, but I would not mix my Java source files in with the web app. Keep them in a separate location and only move the class files to the appropriate location.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!