Just as an FYI, I was able to get it to work by creating my own
CustomManagedBeanResolver:
public class CustomManagedBeanResolver extends ManagedBeanELResolver
{
@Override
public void setValue(ELContext context, Object base, Object property,
Object value)
throws ELException
{
if (base == null && property == null) {
String message = MessageUtils.getExceptionMessageString
(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "base and
property");
throw new PropertyNotFoundException(message);
}
if (base == null) {
FacesContext fc =
(FacesContext)context.getContext(FacesContext.class);
fc.getExternalContext().getRequestMap().put((String)property,
value);
context.setPropertyResolved(true);
}
}
}
And declaring this custom el resolver in faces-config.xml:
<el-resolver>com.mypackage.util.CustomManagedBeanResolver</el-resolver>
Seems to be working ok, just not sure if this will cause any issues.
Thanks,
Geoff
On Wed, Apr 8, 2009 at 8:41 AM, Geoff Longo <[email protected]> wrote:
> I have an application where I am trying to change the JSF implementation
> from MyFaces Core 1.2.6 to Mojarra 1.2_12. I was hoping the application
> could still make use of the tomahawk saveState tag, as we use it heavily
> throughout the application. But it appears that the saveState tag is not
> working properly with Mojarra. I have debugged the issue and have found
> that the saveState and restoreState methods do get invoked, and it is able
> to restore the object successfully. But when the restoreState method tries
> to set the restored object through the ValueExpression, it eventually tries
> to resolve the variable by calling Mojarra's
> ManagedBeanELResolver.setValue() method. Inside this method, there is code
> to create the managed bean if the base is null (which in my case it is,
> however, the property is not). So this causes a new ManagedBean to be
> created, and the one that was restored by saveState is lost. The MyFaces
> ManagedBeanResolver does not have this logic, thus it does not resolve the
> bean and it continues on until the ScopedAttributeResolver class resolves
> it.
>
> My saveState declaration looks like this (we are saving the state of the
> entire bean):
>
> <t:saveState id="MyBackingBean" value="#{MyBackingBean}"/>
>
> I tried to write a custom EL Resolver, but I'm not sure exactly what to do
> in this case, since I want to preserve the behavior of the other Resolvers.
>
> Any ideas?
>
> Thanks,
> Geoff
>