Announcement Announcement Module
Collapse
No announcement yet.
An exception in resolving a bean in JSF + Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • An exception in resolving a bean in JSF + Spring

    Hi,

    I am using JSF (Sun's RI implementation version 1.1) and Spring webflow (1.1-snapshot).

    I created a simple jsf page (sayHello.jsp) with a single input field and a submit button.

    <h:inputText id="name" value="#{myBean.name}" required="true"/>
    <h:commandButton value="submit" action="submit"/>

    I have created another simple jsf page (printName.jsp) which displays the value entered in the above page.

    <h:outputText id="name" value="#{myBean.name}"/>

    I have the flow which looks as below
    <flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
    http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
    <var name="myBean" class="myapp.MyBean" scope="conversation"/>
    <start-state idref="sayHello" />
    <view-state id="sayHello" view="/sayHello.jsp">
    <transition on="submit" to="printName"/>
    </view-state>
    <end-state id="printName" view="/printName.jsp"/>
    </flow>

    The faces config file looks as below:
    <faces-config>
    <application> <navigation-handler>org.springframework.webflow.executor.jsf.F lowNavigationHandler</navigation-handler>
    <variable-resolver>org.springframework.webflow.executor.jsf. DelegatingFlowVariableResolver</variable-resolver>
    </application>
    <lifecycle> <phase-listener>org.springframework.webflow.executor.jsf. FlowPhaseListener</phase-listener>
    </lifecycle>
    </faces-config>

    The application shows the sayHello page and when I enter some value in the text field, and submit the page, on the next page I get the exception as below

    javax.faces.el.PropertyNotFoundException: Error testing property 'name' in bean of type null
    com.sun.faces.el.PropertyResolverImpl.getType(Prop ertyResolverImpl.java:342)
    org.springframework.webflow.executor.jsf.AbstractF lowExecutionPropertyResolver.getType(AbstractFlowE xecutionPropertyResolver.java:59)
    com.sun.faces.el.impl.ArraySuffix.getType(ArraySuf fix.java:240)
    com.sun.faces.el.impl.ComplexValue.getType(Complex Value.java:208)
    com.sun.faces.el.ValueBindingImpl.getType(ValueBin dingImpl.java:345)
    com.sun.faces.renderkit.html_basic.HtmlBasicInputR enderer.getConvertedValue(HtmlBasicInputRenderer.j ava:111)
    javax.faces.component.UIInput.getConvertedValue(UI Input.java:702)
    javax.faces.component.UIInput.validate(UIInput.jav a:627)
    javax.faces.component.UIInput.executeValidate(UIIn put.java:838)
    javax.faces.component.UIInput.processValidators(UI Input.java:412)
    javax.faces.component.UIForm.processValidators(UIF orm.java:170)
    javax.faces.component.UIComponentBase.processValid ators(UIComponentBase.java:904)
    javax.faces.component.UIViewRoot.processValidators (UIViewRoot.java:342)
    com.sun.faces.lifecycle.ProcessValidationsPhase.ex ecute(ProcessValidationsPhase.java:78)
    com.sun.faces.lifecycle.LifecycleImpl.phase(Lifecy cleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.execute(Life cycleImpl.java:90)
    javax.faces.webapp.FacesServlet.service(FacesServl et.java:197)


    I suppose that during the validation phase of the jsf lifecycle, the bean myBean is not accessible. This happens if I use the Sun's JSF implementation. However, if I use the myfaces implementation of JSF, I don't get any exception. Is there anything I am doing wrong here?

    Would appreciate your help.

    Regards,
    Shashi
Working...
X