your exerBeanId is not instantiated, hence the NullPoint Exception.
the exerBeanId from *<jsp:useBean id="exerBeanId" scope="session"
class="jp1.exerBean" />*
is not the same in <% ... exerBeanId.setValues(v); ... %>

They are of different scope.  It's been discussed in the JSP-Interest
Archive.

-----Original Message-----
From: Carl Song [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 6:21 AM
To: [EMAIL PROTECTED]
Subject: How can i pass the value(object) in jsp to javabean ?


Hi everybody out there!!!

I'm very new to JSP and not really efficient with Java either.
but here I'm tring to pass the Vector object in JSP page to Bean in
order to carry out database insertion.
>From Vector object i'm intending to get values for insert.

Does anybody know how to pass the values(object)?
Please help me!!!

Thanks

*************Here is JavaBean(exerBean.java)*********************
package jp1;

import java.util.*;

public class exerBean {
  private String values ;
  Vector v = new Vector();

  public void setValues(Vector v){
    for (int i=0; i<v.size(); i++){
     String val = "";
     String values;
     if (!(i==(v.size()-1))){
        values =val +"\""+v.get(i)+"\""+",";

       }
       else {
        values = val +"\""+v.get(i)+"\"";

       }
    }//end for
          //return values;
}//end setValues()

  public String getString(){
  return values;
  }
}
*************Here is JSP page(exer.jsp)*********************
<HTML>
<HEAD>
<jsp:useBean id="exerBeanId" scope="session" class="jp1.exerBean" />
<jsp:setProperty name="exerBeanId" property="*" />
<TITLE>
exer
</TITLE>
</HEAD>
<BODY>
   <% Vector v = new Vector();

    v.addElement(new String("hello"));
    v.addElement(new String("Bye"));
    v.addElement(new String("go"));

      exerBeanId.setValues(v);                    //***** getting
NullPoint Exception***
     out.println(exerBeanId.getString());
  %>

  <FORM ACTION="exer.jsp" METHOD="POST">
                <P>
  <INPUT TYPE="SUBMIT" VALUE="ENTER">

  </FORM>
</BODY>
</HTML>




---------------------------------------------------------------------

E-mail Confidentiality Notice and Disclaimer

This email and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to which they are
addressed. Access to this e-mail by anyone else is unauthorised. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it, is prohibited.
E-mail messages are not necessarily secure.  Hitachi does not accept
responsibility for any changes made to this message after it was sent.
Please note that Hitachi checks outgoing e-mail messages for the presence of
computer viruses.

---------------------------------------------------------------------

===========================================================================
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://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

===========================================================================
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://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

Reply via email to