File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes iPLanet + JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "iPLanet + JSP" Watch "iPLanet + JSP" New topic
Author

iPLanet + JSP

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hiya, Im new to JSP but quite familiar with servlet development. Im trying to call a bean from my jsp page.
the jsp is on my server root (ie d:\arc_server)
i have set up my servlet directory as follows and
my servlets execute from d:\arc_server\web-inf\classes
if I want my jsp page to use a bean where in iPlanet do I tell it find my bean class. Is there some directory that the JSP engine automatcially looks for the beans??
Thanks for your help
Mike B
Bala Ramachandran
Greenhorn

Joined: Aug 20, 2001
Posts: 12
Originally posted by Mike B:
Hiya, Im new to JSP but quite familiar with servlet development. Im trying to call a bean from my jsp page.
the jsp is on my server root (ie d:\arc_server)
i have set up my servlet directory as follows and
my servlets execute from d:\arc_server\web-inf\classes
if I want my jsp page to use a bean where in iPlanet do I tell it find my bean class. Is there some directory that the JSP engine automatcially looks for the beans??
Thanks for your help
Mike B

Hi,
Just add the directory to your web-server's classpath. Only then the JSP engine will be able to pick up the class.
Whether it be beans or servlet, the directory in which it is stored, needs to be in the web-server's classpath.
Bala.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Cheers Bala, that works nicely!
out of interest, can I call any of my code classes from a JSP or do they have to be "special" javabeans". Im trying normal instantiation and then calling the method and getting nowhere.
ie
<jsp: useBean id="nO" class="com.NewObject"/>
nO.getMyName();
this throws an error; if I do it with say, a Date class ie
<jsp: useBean id="dT" class="java.util.Date"/>
String thisHour = String.valueOf(dT.getHours());
this works fine
whats the difference between me calling my own class (which implements Serializable) and the Date class??
Thanks for your help and your time
Mike B

Bala Ramachandran
Greenhorn

Joined: Aug 20, 2001
Posts: 12
Originally posted by Mike B:
Cheers Bala, that works nicely!
out of interest, can I call any of my code classes from a JSP or do they have to be "special" javabeans". Im trying normal instantiation and then calling the method and getting nowhere.
ie
<jsp: useBean id="nO" class="com.NewObject"/>
nO.getMyName();
this throws an error; if I do it with say, a Date class ie
<jsp: useBean id="dT" class="java.util.Date"/>
String thisHour = String.valueOf(dT.getHours());
this works fine
whats the difference between me calling my own class (which implements Serializable) and the Date class??
Thanks for your help and your time
Mike B

Hi,
What kind of error do you get if you use your own class ?
Anyway generally speaking,
You can instantiate any class from your JSP as long as
i) the location of that class is included in the classpath
ii) import the package in which the class resides in your jsp as
<%@ page session="true" import = "ods.*, java.util.*;" %>
There is not much difference between using system defined classes and your own classes as long as the location of those classes are visible to the JVM (i.e., they are in teh classpath) and the JSP imports the right package.
Hope this helps.
Bala.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Bala,
sorry to bother you again.
Your answer was quite right(again!)
it was a packaging problem. Now that I have used the right jsp header it works fine.
Thanks again Bala
Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: iPLanet + JSP