permaculture playing cards*
The moose likes JSP and the fly likes How to Import a JAVA File in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Import a JAVA File in JSP" Watch "How to Import a JAVA File in JSP" New topic
Author

How to Import a JAVA File in JSP

Santosh Nijalingappa
Greenhorn

Joined: Feb 03, 2008
Posts: 3
Hi,
I have written a statement :<%@ page import="MyBean.java" %> in my JSP.
MyBean.java is my Bean class located in folder WebApps/EnterUserDataApp folder.
How to import this this java file so that i can use the getters and setters of this bean class within my JSP ?
I am doing a simple Servlet JSP application without using struts or tag libraries.
Please Help
Santosh Nijalingappa
Greenhorn

Joined: Feb 03, 2008
Posts: 3
Note: Forgot to mention I am using TomCat Server and my directory structure is as follows:
C:\apache-tomcat-5.5.17\webapps\EnterUserDataApp

Within this EnterUserDataApp folder i have my
WEB-INF folder and i am placing my JSP, Servlet and bean java file in EnterUserDataApp folder.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Please see the JSP FAQ entries. They will explain where you must place your class files.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Compile MyBean.java class and place compiled class (MyBean.class) into WEB-INF folder of your application.

Also, must look at the directory structure of application deployed on tomcat.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42620
    
  65
Note that the import attribute takes neither a source file name nor a class file name, but a class name. That would be MyBean in your case, plus the appropriate package name in front of it.


Ping & DNS - my free Android networking tools app
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Ulf Dittmer:
Note that the import attribute takes neither a source file name nor a class file name, but a class name. That would be MyBean in your case, plus the appropriate package name in front of it.


Yep. I missed that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Import a JAVA File in JSP