Amanda Fu wrote:
>
> hi, I'm a new comer to Jsp, work on jswdk1.0.1. Here is a question about
> java bean, hope any help.
> Following are two jsp:
>
> Login.jsp
> <%@ page import="java.util.*, library.Map" %>
> <jsp:useBean id = "mymap" scope = "session" class="library.Map" />
> <jsp:setProperty name ="mymap" property="username" param ="username" />
> ...
> <FORM NAME="Form1" METHOD="GET" ACTION="Library.jsp">
> ....
>
> Library.jsp:
> <%@ page import="java.util.*, library.Map" %>
> ....
> <jsp:getProperty name ="mymap" property="username" />
>
> when it runs , an exception will be thrown such as:
> com.sun.jsp.JspException getProperty: Bean mymap not found.
You need a <jsp:useBean> action element in Library.jsp as well. If it still
doesn't work, try upgrading to the latest version of the reference
implementation,
i.e. Tomcat at <http://jakarta.apache.org/>.
> if use
> <%= mymap.getUsername() %>
> it will say,
> Undefined variable or class name : mymap
That's because you don't have <jsp:useBean> in the Library.jsp page.
You need this action element to make the bean available for scripting
elements and <jsp:getProperty> elements in the page.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets