struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Roast" <kevin.ro...@activiti.com>
Subject RE: Form bean is null in pagecontext? - OK let's try this again...
Date Mon, 07 Oct 2002 11:16:28 GMT
Hi,
 
OK, it appears that I'm using the wrong key here - i.e. I should be
using BEAN_KEY to get the Form bean not the form tag (doh).
 
HOWEVER - this doesn't explain why the ALL of the attributes on the
request scope are "null" e.g. I've printed them out to the console:
 
org.apache.struts.taglib.html.FORM=null
dataForm=null
org.apache.struts.taglib.html.BEAN=null
 
I've looked at the Struts code that sets the attributes in
FormTag.doStartTag() and it looks ok:
 
        // Store this tag itself as a page attribute
        pageContext.setAttribute(Constants.FORM_KEY, this,
PageContext.REQUEST_SCOPE);
 
Any ideas what's going on here?
 
Cheers,
 
Kev

	-----Original Message-----
	From: Kevin Roast 
	Sent: 07 October 2002 10:28
	To: struts-user@jakarta.apache.org
	Subject: Form bean is null in pagecontext? 
	
	

	Hi, 

	Does anyone know, at what point does the form bean get added to
the pageContext as an attribute? (with the key 
	org.apache.struts.taglib.html.Constants.FORM_KEY) 

	The reason I ask, is that I have a custom tag that needs to
access the form bean class directly (I have created a base form bean
class with methods I require), and I'm trying to do something like this
in the tag code:


	BaseForm form =
(BaseForm)pageContext.getAttribute(Constants.FORM_KEY); 


	Where "BaseForm" is my form bean base class type. 

	However this returns null. Any ideas? The form is specified as
"request" scope in the config file. 

	Thanks, 

	Kev 
	


Mime
View raw message