• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Instantiating a class from inside a jsp

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have the following file structure:
Project
--> src
--> java
--> a class called "Row.java"
--> Web
--> main.jsp

my question is how can the jsp main know where the class Row is so that it can instantiate objects from the class and do something like:
Row r = (Row) request.getAttribute("row");

thank you..
Regards,
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the Servlet Specification. Your web application must follow certain rules so that it can do things such as finding the classes. Your class files must be in a package other than the default, and must either be placed in the folder hierarchy under WEB-INF/classes, or zipped up into a jar file and placed in WEB-INF/lib.

The source (.java) files are not part of the application.
[ April 15, 2006: Message edited by: Bear Bibeault ]
 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,
I am actually using the netBeans IDE for developping this application.
and it's by default set all the file hierarchy.
How can I deal with that ?
 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and yes, when the project is built all the compiled java code is placed in build/web/WEB-INF/classes
where the jsps are placed in: build/web
thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic