| Author |
Instantiating a class from inside a jsp
|
aymane chetibi
Ranch Hand
Joined: Apr 12, 2006
Posts: 175
|
|
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
Joined: Jan 10, 2002
Posts: 56547
|
|
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 ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
aymane chetibi
Ranch Hand
Joined: Apr 12, 2006
Posts: 175
|
|
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
Joined: Apr 12, 2006
Posts: 175
|
|
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.
|
 |
 |
|
|
subject: Instantiating a class from inside a jsp
|
|
|