Tim:
 
Thanks for tolerating me with these simple questions.
I tried your method getProperty). But still I am having problems.
 
This is what I want to do. I have a simple java bean. I have a String variable x. I want to print the value of that x in the browser using JSP.
 
This is what I tried:
1. I wrote a getter public String getX() in the bean and tried to access the method. The error was: No such method found.
 
2. I tried the getProperty in the JSP page. Error: no such property in Bean.
 
Where am I wrong.
 
I am also going thru the link you sent me.
 
Thanks
 
/KK
----- Original Message -----
From: "Chen, Gin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 21, 2001 12:17 PM
Subject: Re: TomCat Classpath

> I have never had to do what you guys are doing with the import before. Even
> when my class doesnt have a package. I think something might be missing from
> your classpath. Regardless, in answer to your second question.
>
> if ur property name was the same as the bean property name then u could just
> use:
> <jsp:setProperty name="mybean" property="*" />
> so if u wanted to set mybean.username to a request parameter username.
>
> But if ur bean variable was X and ur request parameter was username,
> then you have to set mybean.x as:
> <jsp:setProperty name="mybean" property="x" value="<%=
> request.getParameter(\"username\")%>" />
>
> Here's a helpful reference for u since ur obviously just starting to learn
> jsps:
>        
http://java.sun.com/products/jsp/tags/12/syntaxref12.html
> Also look at the java.sun.com tutorials for jsp/servlets.
>
> -Tim
>
> -----Original Message-----
> From: Ketharinath Kamalanathan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 21, 2001 1:12 PM
> To:
[EMAIL PROTECTED]
> Subject: Re: TomCat Classpath
>
>
> 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
>
> ===========================================================================
> 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