Ricardo:

Thanks for the explanation. It worked. Actually, I do not have any package.
I followed what you said and included the import. I am able to access the
bean!

But here is another:

I have a method in the bean that returns a String. I am tryi1ng to print
that value in the browser using JSP.

This is what I have in th JSP:

<%@ page language="Java" %>
<%@ page import="xyz"%>
<jsp:useBean id="abc" scope="page" class="xyz" />

<%! String c=null; %>

<%=request.getParameter("username")%>
<%=request.getParameter("password")%>
And the name:
<%=abc.returnX() %>

What I get in theh browser is just a 1. What am I missing here?

Thanks
/KK
----- Original Message -----
From: "Ricardo Rocha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 21, 2001 11:19 AM
Subject: Re: TomCat Classpath


> > Next problem: I have a small class which I need to instantiate in the
> JSP. > I am using useBean, obviously. Looks like the class is being
> searched in
> > 'org.apache.jsp.xyz '. But my .class file is in myapp/webinf/classes >
> folder.
> > I do not have any package statement in the bean.
> >
> > Question:
> >
> > Should I have to set anything in the class path?
> >
> > Thanks
>
> if you don't put your class in a package, you have to import the class
> using the page directive...
> if you do put it a package, all you need is to put the package in the
> /myapp/web-inf/classes directory and reference it in the page
>
> like:
>
> with:
> /myapp/web-inf/classes/mypackage/myclass.class
> in the jsp page:
> <jsp:useBean id="something" class="mypackage.myclass" session="scope"/>
>
> otherwise:
> <%@ page import="myclass.class"%>
> and you put the class in /myapp/web-inf/classes/myclass.class
> <jsp:useBean id="something" class="myclass" session="scope"/>
>
> Hope this helps...
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to