I definetely am populating the form variable..

here is the action class

public class InitMffsAction extends Action
{
  public ActionForward perform(ActionMapping actionMapping,
                               ActionForm actionForm,
                               HttpServletRequest httpServletRequest,
                               HttpServletResponse httpServletResponse)
  {
    PropertyResourceBundle prb = null;
    try
    {
      System.out.println(
          "---------------Printing from within perform of
LegaldocsqueryinitAction : " +
          actionMapping.toString());
      System.out.println(
          "---------------Printing from within perform of
LegaldocsqueryinitAction : " +
          httpServletRequest.toString());
      lam.mffs.form.MffsActionForm mfform = (lam.mffs.form.MffsActionForm)
                                            actionForm;
      InputStream is = this.getClass().getClassLoader().getResourceAsStream(
          "lam/mffs/action/mffsdata.properties");
      prb = new PropertyResourceBundle(is);
      Context ctx = this.getInitialContext(prb.getString(
          "servlet.initialcontext.url"));
      MffsSessionHome home = (MffsSessionHome)ctx.lookup("MffsSession");
      MffsSessionRemote admin = (MffsSessionRemote)home.create();

      mfform.setEnd_date(admin.getEndDate());
      mfform.setProduct_desc(admin.getProdctDescription());
      mfform.setTableNames(admin.getTableNames());
    }
    catch (Exception e)
    {
      LamLog.log(this, LamLog.FATAL,
                 "Problem getting initial data from ejb " + e.getMessage());
      throw new java.lang.UnsupportedOperationException(
          "Method perform() has thrown an exception " + e.getMessage());
    }
    return actionMapping.findForward("success");
  }

  private Context getInitialContext(String url) throws Exception
  {
    Properties properties = null;
    try
    {
      properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY,
                     "weblogic.jndi.WLInitialContextFactory");
      properties.put(Context.PROVIDER_URL, url);
    }
    catch (Exception e)
    {
      LamLog.log(this, LamLog.FATAL,
                 "Unable to connect to WebLogic server at " + url);
      throw e;
    }
    return new InitialContext(properties);
  }

}


                                                                                       
                             
                                                                                       
                             
                                         To:     "Struts Users Mailing List" 
<[EMAIL PROTECTED]>       
             "James Mitchell"            cc:                                           
                             
             <[EMAIL PROTECTED]        Subject:     Re: using <bean:define>          
                             
             g>                                                                        
                             
             14 Feb 2003 09:36 AM                                                      
                             
             Please respond to                                                         
                             
             "Struts Users                                                             
                             
             Mailing List"                                                             
                             
                                                                                       
                             
                                                                                       
                             



In your action class, are you actually populating a List in your form before
forwarding to that page?

>From the error, it appears that getTableNames() on your form is returning
null.


--
James Mitchell





----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 5:30 PM
Subject: using <bean:define>


> Hi,
>
>  I am new to struts.
>
>  I am trying to use the
>
> <html:options collection="tableNames"
>
> I get the error
>
> javax.servlet.jsp.JspException: Define tag cannot set a null value
>         at
org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:272)
>         at jsp_servlet.__mffs._jspService(__mffs.java:237)
>
>
> What am I doing wrong when I am trying to create the bean
>
> <bean:define id="tableNames"
>                      name="mffsActionForm"
>                         property="tableNames"
>                      type="java.util.List" />
>
> Regards
> Rajesh J
>
> Here is the JSP code
>
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
>
> <html:html>
>
> <head>
>
> <title>MFFS</title>
> </head>
>
> <body topmargin="0" leftmargin="0">
>
> <table border="0" width="100%" height="100%" cellspacing="0"
cellpadding="0">
>   <tr>
>     <td width="100%" height="72" bgcolor="#000066" style="color: #FFFFFF">
> &nbsp;<strong><font size="8" face="ATSackLightRomNoBalls"><html:img
width="61"
> height="45" src="images/top.bmp" border="0"/>MFFS</font></strong></td>
>   </tr>
>   <tr>
>     <td width="100%" height="20" bgcolor="#EAFFFF">&nbsp;</td>
>   </tr>
>   <tr>
>     <td width="100%" height="95%" valign="middle" align="center">
>       <html:form
>                action="mffsAction"
>                name="mffsActionForm"
>                type="lam.mffs.form.MffsActionForm"
>                scope="session" >
>         <p>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
>         </p>
>         <table border="1" height="33" bordercolor="#000000"
bordercolorlight="
> #000000" bordercolordark="#000000">
>           <tr>
>             <td width="100" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"><font size="2">End
> Date</font></td>
>             <td width="100" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"> <html:text property
> ="end_date" size="10"/></td>
>             <td width="150" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"><font size="2">
Choose
> Table</font></td>
>             <td width="200" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5">
>               <font size="2">
>                 <bean:define id="tableNames"
>                      name="mffsActionForm"
>                         property="tableNames"
>                      type="java.util.List" />
>
>               <html:select property="tables" style="font-size: 10pt"
size="1">
>                 <html:options collection="tableNames" labelProperty
> ="labelProperty" property="property"/>
>               </html:select></font></td>
>             <td width="200" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"><font size="2">
Product
> Description</font></td>
>             <td width="300" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"><font size="2">
>               </font></td>
>             <td width="130" height="27" bordercolor="#FFFFFF"
bordercolorlight="
> #FFFFFF" bordercolordark="#FFFFFF" bgcolor="#e0ebf5"><applet code
> ="fphover.class" codebase="./" width="120" height="24">
>           <param name="color" value="#000080">
>           <param name="hovercolor" value="#0000FF">
>           <param name="textcolor" value="#FFFFFF">
>           <param name="text" value="Get Data">
>           <param name="effect" value="glow">
>         </applet>
>             </td>
>           </tr>
>         </table>
>         <p>
>         &nbsp;
>         </p>
>     </html:form>
>
>     </td>
>   </tr>
> </table>
>
> </body>
>
> </html:html>
>
>
> here is my formbean
>
> public class MffsActionForm extends ActionForm
> {
>   private String tables;
>   private List tableNames;
>   private Date end_date;
>   private List product_desc;
>   public void setTables(String Tables)
>   {
>     this.tables = Tables;
>   }
>   public String getTables()
>   {
>     return tables;
>   }
>   public void setEnd_date(Date end_date)
>   {
>     this.end_date = end_date;
>   }
>   public Date getEnd_date()
>   {
>     return end_date;
>   }
>   public void setProduct_desc(List product_desc)
>   {
>     this.product_desc = product_desc;
>   }
>   public List getProduct_desc()
>   {
>     return product_desc;
>   }
>   public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest
> httpServletRequest)
>   {
>     /**@todo: finish this method, this is just the skeleton.*/
>     return null;
>   }
>   public void reset(ActionMapping actionMapping, HttpServletRequest
> httpServletRequest)
>   {
>     tables = null;
>     end_date = null;
>     product_desc = null;
>   }
>   public List getTableNames()
>   {
>     return tableNames;
>   }
>   public void setTableNames(List tableNames)
>   {
>     this.tableNames = tableNames;
>   }
> }
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to