[jboss-user] [JBoss Seam] - Re: How to link to page using level of indirection
You could use with action parameter. The action event should return a view-id (JSF or otherwise). Using the SeamFaceletViewHandler you should be able to pass parameters to the action event e.g #{myBean.objectSelected(x)} View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031877#4031877 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031877 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to link to page using level of indirection
Your selection action passes the object x. You may be able to return a string of the view such as "/myobjectview.seam?id=" + x.id. I haven't tried this. Better still you could use the navigation rules in pages.xml as per the seam documentation (section 5.1.1.2): | | | | | | | | | | | | | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032248#4032248 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032248 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Multi-role components
I have a backing bean which is used in both the session and conversation context as follows: | @Name("searchCompany") | @Scope(ScopeType.SESSION) | @Roles( [EMAIL PROTECTED](name="findCompany",scope=ScopeType.CONVERSATION)} ) | In order for the outjected datamodel list to pick up the correct value on the page I have to use the page scope for the datamodel: | @DataModel(value="companyList",scope=ScopeType.PAGE) | public List getResultList() { | return super.getResultList(); | } | If I do not limit the scope to page then if a I use the bean in a convesation and a previously instantiated session bean exists then the page (in a conversation) uses the session datamodel before a search has occured. Clicking on the list results in an error as the list was not generated by the conversation bean. So it appears that I've solved my problem, but I can no longer use expressions such as the following in a dataTable: | | #{company.companyName} | | I guess this is because the datamodel doesn't have "sufficient" scope at the time of the action, or perhaps seam doesn't look in the page scope when doing action events. This problem is different from datamodelselection, which works for page scoped datamodel that postback to the same bean as the datamodel. Is this just a fact of life with seam, or is there a better way ? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032264#4032264 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032264 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - JSF and TransactionalSeamPhaseListener
This is more a question of design or understanding: In order to avoid the lazy initialization exception I have followed the seam examples and used the TransactionalSeamPhaseListener and configured the components.xml correctly. The entity manager is now injected using the @In annotation. I can now retrieve my entities without problem however this raises an issue about JSF model updates which over-write the primary key of a ManyToOne entity. Example: | EJB3: | @Entity | public class Person extends { | private Title title; | | @ManyToOne(cascade = {}, fetch = FetchType.EAGER) | @JoinColumn(name = "title_id", unique = false, nullable = true, insertable = true, updatable = true) | public Title getTitle() { | return this.title; | } | . | . | } | | Backing Bean: | @Stateful | @Scope(ScopeType.CONVERSATION) | @Name("editPerson") | public class EditPerson { | @In | private EntityManager entityManager; | @Out | private Person person; | . | . | } | | JSF: | | The problem occurs when the title is changed in the selectOneMenu from say "Mr" to "Mrs". JSF applies its model changes to person.title.titleId which changes the primary key of the managed entity. Any calls to persist the person entity fail as two title objects exist with the same primary key This seems to be a general problem for JSF pages wanting to write directly to managed entities. To avoid this problem I have reverted to the standard SeamPhaseListener and use the @PersistenceContext. The entity is now "disconnected" and calls to merge() no longer complain about the change in primary key they just perform the update. i.e update person set titleId=2 . . . This solution means that I have to initialise every lazy collection manually before passing it to JSF. A possible solution is to intercept the model update before it is applied and set the title on person to the changed title: | newTitleId = {Get model value for titleId} | newTitle = em.find(Title.class, newTitleId) | person.setTitle(newTitle) | {Stop model update of person.title.titleId} | Another solution is have all selectOneMenus writing their value back to a property on the backing bean instead of the entity. This however really curbs flexibility with reuse. How should I do this? Is there a better way? Does anyone have a better design solution? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022862#4022862 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4022862 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: JSF and TransactionalSeamPhaseListener
Thank you for your help. I am now using Seam's EntityConvertor http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamEntityConverter [/url] View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4023325#4023325 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4023325 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - pageflow annotation and pages.xml
I am using seam 1.20. I have a problem starting a pageflow: If I use the pageflow property of the @Begin annotation the pageflow will not start and subsequently will not move from the first page. e.g: | Pageflow | | | | | | | @Create @Begin(flushMode=FlushModeType.MANUAL,pageflow="linkCorrespondence") | public void create() { | } However the following code does work when using the depreciated function: | @Create @Begin(flushMode=FlushModeType.MANUAL,pageflow="linkCorrespondence") | public void create() { | Conversation.instance().beginPageflow("linkCorrespondence"); | } | The pageflow does work if I use element in the pages.xml: | | | Link new correspondence | | However the conversation must specify join="true". If it does not and the page refreshes or submits then a new conversation is started which produces an error. I also notice that if the conversation is started using that the conversation description is not shown in the conversationList or on the debug.seam page. Is this a consequence of specifying join=true? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030896#4030896 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030896 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: pageflow annotation and pages.xml
The seam documentation states in section 7.2.2: anonymous wrote : | If we are beginning the pageflow during the RENDER_RESPONSE phase?during a @Factory or @Create method, for example?we consider ourselves to be already at the page being rendered, and use a node as the first node in the pageflow, as in the example above. | I have annotated the @Create method which is called during the RENDER_RESPONSE phase. Is the documentation correct? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030920#4030920 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030920 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - convertEntity: mixing session and conversation data
I am using Seam 1.2.1GA and I have problem with s:convertEntity such as: | | | | | The bean loggedInUser is a session bean. When the form submits JSF reports that the field is not valid. I have debugged the EntityConverter class and it returns the selected value correctly from the getAsObject function. This means (I assume) the validation error is occuring within JSF, in my case MyFaces. The session bean function is: | public List getBranchList() { | return this.flattenedBranches; | } | To experiment I sourced the list from a bean in the current conversation. This function gets the list from the session bean and merges it (using entityManager) into a local list. | @In(value="loggedInUser", required=true) | private IUser user; | | private List userBranchList; | public List getUserBranchList() { | if (this.userBranchList == null) { | this.userBranchList = new ArrayList(); | Iterator itr = this.loggedInUser.getBranchList().iterator(); | while (itr.hasNext()) { | Company branch = (Company)itr.next(); | | this.userBranchList.add(super.getEntityManager().merge(branch)); | } | } | | return this.userBranchList; | } | This works without JSF reporting any validation problems. I really don't understand why this does not work for session data as the EntityConverter class uses entityManager.find to look-up the data using the data's primary key. This means that the EntityConverter is returning a "merged" result using the current conversation's entityManager. Does anyone have any thoughts? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071015#4071015 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071015 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user