[ 
https://issues.apache.org/jira/browse/ORCHESTRA-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620154#action_12620154
 ] 

Stefan Glase commented on ORCHESTRA-28:
---------------------------------------

Hello Simon,

thank you for your reply.

Your suggested workaround does not work, because getClass() comes from 
java.lang.Object and so it will have no influence on the lifetime of the 
conversation. The only way suitable for me was implementing and calling a 
getter that returns a zero string. With the help of css I can make it invisible 
on the view layer but in the end it does not really look clean and the way it 
should be.

I am looking forward to your solution.

Thanks
Stefan

> 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.
> My ugly workaround can be seen in the bottom of the CategoryController 
> implementation and the view, where I fetch this fake-property just to have a 
> call to a bean-method.
> ***************************************************************************************************************************
> 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