1 Reply Latest reply on Jan 9, 2008 7:49 PM by Pete Muir

    Design question with facelets

    Andrew Elegante Newbie

      Hi,

      I have a question about the proper way to design a project. I have an entity that the user can create, search for, and edit.

      Creating the entity goes through a multi-page wizard. This is managed via a stateful session bean (WizardBean) with a conversation context and a jbpdl pageflow.

      Editing the entity is on a single page. This is also managed via a stateful session bean (EditorBean).

      In both of these beans I have the same variable name (ex: entity) with an @Out annotation.

      Following the DRY principal, I have created a base class which contains the validation code and some other common ajax UI functions. I'm using facelets to re-use the UI for each of these. Because two different session/backing beans use these pages I created an alias variable and in the appropriate pages I use a c:set to set the variable's value before the ui:include tag. Since both backing beans export the same variable name I have not created a similar variable for the bean that is being edited/created.

      My question is whether this is a good design pattern or not. I'm not sure if I should just be using one stateful bean with functionality for both create and edit and I'm not sure if it's okay for 2 different SFSB's to export the same variable name in a conversation scope (for the record the editing and creating should always happen in different conversations).

      Thanks,

      Drew