-
1. Re: Passing var via method
danielc.roth Apr 1, 2008 10:36 AM (in response to wachtda.scsi.gmx.ch)Same happens to me from time to time. I would recommend using @DataModel and @DataModelSelection instead like inte the example 1.11:
@Stateful @Scope(SESSION) @Name("messageManager") public class MessageManagerBean implements Serializable, MessageManager { @DataModel (1) private List<Message> messageList; @DataModelSelection (2) @Out(required=false) (3) private Message message; @PersistenceContext(type=EXTENDED) (4) private EntityManager em; @Factory("messageList") (5) public void findMessages() { messageList = em.createQuery("from Message msg order by msg.datetime desc") .getResultList(); } public void select() (6) { message.setRead(true); } public void delete() (7) { messageList.remove(message); em.remove(message); message=null; } @Remove (8) public void destroy() {} }
-
2. Re: Passing var via method
mars1412 Apr 1, 2008 10:41 AM (in response to wachtda.scsi.gmx.ch)just a guess, but could you please try this:
rename your ID field to Id (upper/lowercase) and also your getter/setters and try again.This works fine for me and AFAIK this should work OOTB.
If this does not solve your problem show some more code of your entity and session bean.
-
3. Re: Passing var via method
wachtda.scsi.gmx.ch Apr 1, 2008 10:50 AM (in response to wachtda.scsi.gmx.ch)The problem is, that my method is not in the same bean as the datamodel. (i need this method in several views...)
-
4. Re: Passing var via method
damianharvey.damianharvey.gmail.com Apr 1, 2008 11:09 AM (in response to wachtda.scsi.gmx.ch)I'd be surprised if this worked. See the EL Limitations Chapter in the docs
If you use h:commandLink/Button or a4j:commandLink/Button it will work. My pattern for s:link is to have a stub method in the same Bean as the @DataModel that calls the method in the Bean that actually implements the functionality.
Cheers,
Damian.
-
5. Re: Passing var via method
mars1412 Apr 1, 2008 11:43 AM (in response to wachtda.scsi.gmx.ch)yipp - you are right
in fact my example uses a4j:commandLink not s:link
sorry for not reading thoroughly..
-
6. Re: Passing var via method
wachtda.scsi.gmx.ch Apr 1, 2008 12:50 PM (in response to wachtda.scsi.gmx.ch)Ok, it was my fault...
Now I know what's the problem, thank you damian! -
7. Re: Passing var via method
wachtda.scsi.gmx.ch Apr 1, 2008 1:24 PM (in response to wachtda.scsi.gmx.ch)Now I have another problem.
I have a device list, if I click on a device I want to display a popup with the log entries of the selected device.My Problem is, that the factory which will call the device list is invoked before the method which will select the actual device:
<h:commandLink action="#{logEntryAction.selectDevice(node.ID)}" onclick="window.open('notes.seam', 'notes', 'width=1024,height=600')" value="#{msg.f_edit}" />
Because the onklick() method is called before the action() the device is not selected if the pages notes.seam gets the list via a factory. How can I make, that the action() is called befor the onklick()?
Thank you, Daniel
-
8. Re: Passing var via method
mars1412 Apr 1, 2008 2:20 PM (in response to wachtda.scsi.gmx.ch)I suggest you use an a:commandButton with your action and instead of onclick, you use oncomplete