Conversation (Access) is lost when jsf validation fails
-------------------------------------------------------

                 Key: ORCHESTRA-28
                 URL: https://issues.apache.org/jira/browse/ORCHESTRA-28
             Project: MyFaces Orchestra
          Issue Type: Bug
          Components: Conversation
    Affects Versions: 1.1
            Reporter: Stefan Glase
            Priority: Critical


I am loosing my conversation the bean CategoryController is in, when 
required-validation in the view fails. 

Without further investigation it looks like it can be explained in the 
following way: Orchestra uses a proxy-class to notice calls to 
bean-methods,-getters or -setters while in the conversation and when there is 
no direct access to the bean from the view, the access scope will be lost. 

That is fine in standard cases but when calls only go to the extending class 
this behaviour should be considered wrong.

***************************************************************************************************************************
Class: CategoryController
***************************************************************************************************************************

@Controller
@Scope("conversation.access")
public class CategoryController extends AbstractCrudController<Category> {

    private CategoryService categoryService;

    @Resource
    public void setCategoryService(CategoryService categoryService) {
        this.categoryService = categoryService;
    }

    @Override
    protected CategoryService getService() {
        return this.categoryService;
    }

    /**
     * Bug: Orchestra invalidiert eine Klasse X, welche eine Klasse Y 
erweitert, wenn in einem
     * Request-Zyklus lediglich Zugriffe auf Methoden und Properties von Y 
erfolgt sind.
     * 
     * @return Leerer String
     */
    public String getBug() {
        return "";
    }

}

***************************************************************************************************************************
Class: AbstractCrudController
***************************************************************************************************************************

public abstract class AbstractCrudController<T extends PersistentEntity> {

    private T entity;

    public T getEntity() {
        return entity;
    }

}

***************************************************************************************************************************
View: categoryEditForm.xhtml
***************************************************************************************************************************

       <h:form>

            <h:panelGrid columns="3">

                <h:outputLabel value="#{msg.category_name}" for="name" />
                <h:inputText size="40" id="name" 
value="#{categoryController.entity.name}"
                    required="true" />
                <h:message for="name" />

                <h:outputLabel value="#{msg.category_description}" 
for="description" />
                <h:inputTextarea rows="3" cols="40" id="description"
                    value="#{categoryController.entity.description}" 
required="true" />
                <h:message for="description" />

            </h:panelGrid>

            <h:panelGrid columns="2">

                <h:commandButton action="#{categoryController.doSaveEntity}"
                    value="#{msg.category_save}" />

            </h:panelGrid>

            <!-- === Bug === -->
            <h:outputText value="#{categoryController.bug}" />
            <!-- === End of Bug === -->

        </h:form>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to