You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Pfeiffer <ws...@tampabay.rr.com> on 2002/08/21 23:14:09 UTC

FormTag default name not set in Struts 1.1 b2

I just converted from 1.1 b1 to 1.1 b2 and encountered this problem.

We have several tags that we coded to live nested within the struts form tag.  They do a getParent, check for instanceof FormTag and do a getName().  This use to work fine.  With 1.1 b2, the FormTag.getName() method started returning null.  When checked in the debugger, the name property on FormTag was indeed null.  This is occurring on jsp's where the FormTag attribute is not beoing explicitly set.  The docs indicate that the name and object type will be pulled from the struts-config.  This does not appear to be the case for the name property/attribute.

Any ideas?

TIA,

Bill Pfeiffer

-----------------
Failing code:

public static String getParentFormName(TagSupport tag)
{
  String retval = null;

  // find the parent tag that is a struts form
  Tag parentFormTag = null;
  try
  {
   parentFormTag = TagSupport.findAncestorWithClass(tag, Class.forName("org.apache.struts.taglib.html.FormTag"));
  }
  catch (ClassNotFoundException e)
  {
            cat.error("FormTag not found", e);
  }

  // if found
  if (parentFormTag != null)
  {
   // get the form name
   retval = ((FormTag) parentFormTag).getName();
  }
  return retval;
 }