• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Instantiating a class from inside a jsp

 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • 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,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic