| Author |
JSP file and java class in the same package
|
sree hareesh
Greenhorn
Joined: Nov 16, 2011
Posts: 11
|
|
Hi all,
I have JSP file and java class in the same package, how can i use java class in JSP.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
You shouldn't. Using Java code in a JSP has been obsolete since 2002.
Perform any Java code in the page controller servlet and use the JSTL and EL in the JSP. Any data you need can be placed in request scope by the controller, where the JSP will be able to easily access it.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1004
|
|
>I have JSP file and java class in the same package
That just sounds horribly wrong.
JSPs don't belong in packages.
Your JSP code should be COMPLETELY separate from your java classes.
In a web application, your JSPs are resources to load.
Java classes are compiled, and are normally made available to a web app via the WEB-INF/classes directory, or a jar file in the WEB-INF/lib directory.
|
 |
 |
|
|
subject: JSP file and java class in the same package
|
|
|