Sourav,

You must look for your FormBean in request scope, not in page. You setted
this in your 'scope' action tag atribute.

Expedito Jr.

-----Mensagem original-----
De: Nicolas Robert [mailto:[EMAIL PROTECTED]]
Enviada em: quarta-feira, 5 de fevereiro de 2003 10:13
Para: 'Struts Users Mailing List'
Assunto: RE: Form Bean could not be accessed from my custom Tag


Hi,

You could try this code sample (which come's from
/src/share/org/apache/struts/taglib/bean/WriteTag.java) :

    public int doStartTag() throws JspException {

        // Look up the requested bean (if necessary)
        if (ignore) {
            if (RequestUtils.lookup(pageContext, name, scope) == null)
                return (SKIP_BODY);  // Nothing to output
        }

        // Look up the requested property value
        Object value =
            RequestUtils.lookup(pageContext, name, property, scope);


Have a nice day !


Nicolas

-----Original Message-----
From: Souravmay Das [mailto:[EMAIL PROTECTED]]
Sent: mercredi 5 février 2003 9:59
To: [EMAIL PROTECTED]
Subject: Form Bean could not be accessed from my custom Tag


Hi All,
   I am trying to access FormBean from my customTag
class. I used the following code scriplet in my tag class

ActionForm form = ( ActionForm )pageContext.getAttribute(
"webutilCollapse" );

and I have registered the same name [webutilCollapse] in struts-config.xml
It looks something like this
    <form-bean      name="webutilCollapse" type="tavant.CollapseForm">
    </form-bean>
   <action-mappings>
    <action    path="/setPermissions" type="tavant.CollapseAction"
scope="request" name="webutilCollapse" input="/2.jsp">
      <forward name="success"   path="/2.jsp" redirect="true"/>
    </action>
  </action-mappings>
In my CollapseAction , I just forward it to success token .It look some
thing like this:

    public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest request,HttpServletResponse response)throws
Exception {
         return ( mapping.findForward("success") );
    }

but some how pageContext.getAttribute( "webutilCollapse" ) return me a null.
Every time.

any idea or help ?

regards,
Sourav


---------------------------------------------------------------------
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