I struggled with pretty much the same error message all weekend, getting
more and more frustrated because I could see the getter method.  Turns out,
I wasn't returning the object that I thought I was, so there indeed was no
getter method for the property that was being referenced.

See if you can print the output of the troublesome variable to console in
your action class.  You may discover that you're not dealing with the
object(s) you think you are... 

-----Original Message-----
From: David Rothschadl [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, December 28, 2002 10:49 AM
To: Struts Users Mailing List
Subject: Still no getter method available...



I am still getting the Error Message: No getter method for property
geozoneID of bean org.apache.struts.taglib.html.BEAN. 
I have tried everything.....maybe my Action class is not right, which would
not surprise me, since this is my maiden voyage into the Java world. Here is
the code. Any help would be greatly appreciated!
 

package tgt.transportation.points.action;

import java.io.IOException;

import java.lang.reflect.InvocationTargetException;

import java.util.Locale;

import java.util.Hashtable;

import java.util.Date;

import java.util.Vector;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionError;

import org.apache.struts.action.ActionErrors;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

 

public class GeoZoneAction extends org.apache.struts.action.Action {

// Method signature

public ActionForward perform(

         ActionMapping mapping, 

         ActionForm form,

        HttpServletRequest request,

       HttpServletResponse response)

         throws IOException, ServletException {



// Extract attributes we will need

Locale locale = getLocale(request);

MessageResources messages = getResources();

HttpSession session = request.getSession();

GeoZoneForm geoForm = (GeoZoneForm) form;

String action = request.getParameter("action");

if (action == null)

    action = "Create";

    if (servlet.getDebug() >= 1)

        servlet.log("GeoZoneAction: Processing " + action + " action");

    Hashtable database = (Hashtable)

       servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);

            if (servlet.getDebug() >= 1)

                servlet.log("GeoZoneAction: Processing " + action + "
action");

// Populate the GeoZone form

if (form == null) {

            if (servlet.getDebug() >= 1)

               servlet.log(" Creating new GeoZoneForm bean under key "

                                  + mapping.getAttribute());

              form = new GeoZoneForm();

                 if ("request".equals(mapping.getScope()))

                        request.setAttribute(mapping.getAttribute(), form);

               else

                        session.setAttribute(mapping.getAttribute(), form);

}



GeoZoneForm geoForm = (GeoZoneForm) form;

   if (user != null) {

                if (servlet.getDebug() >= 1)

                    servlet.log(" Populating form from " + user);

                try {

                    PropertyUtils.copyProperties(geoForm, user);

                    geoForm.setAction(action);

                    geoForm.setGeozoneID(null);

                    geoForm.setGeozoneName(null);

               } catch (InvocationTargetException e) {

                    Throwable t = e.getTargetException();

                    if (t == null)

                        t = e;

                   servlet.log("GeoZoneForm.populate", t);

                   throw new ServletException("GeoZoneForm.populate", t);

              } catch (Throwable t) {

                   servlet.log("GeoZoneForm.populate", t);

                   throw new ServletException("GeoZoneForm.populate", t);

               }

}

       // Set a transactional control token to prevent double posting

       if (servlet.getDebug() >= 1)

            servlet.log(" Setting transactional control token");

        saveToken(request);

    // Forward control to the Geographic Zone Maintenance page

         if (servlet.getDebug() >= 1)

             servlet.log(" Forwarding to 'GeoZoneMaint' page");

     return (mapping.findForward("GeoZoneMaint"));

   }

}

 

David Rothschadl

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

Reply via email to