"djfjboss" wrote : I had also assumed that the setPid method would be invoked
via the edit link and thereby set person to the appropriate entity via the id,
but this method isn't even called for me. The fact that the RequestParameter
annotation is commented out is a little disconcerting.
The pid attribute will not be set unless you uncomment the @RequestParameter
annotation (which will directly inject the value) or add an entry in your
pages.xml which will call your set method such as,
| <pages>
| <page view-id="/person.xhtml">
| <param name="pid" value="#{manager.id}"/>
| </page>
| ...
| </pages>
I also do not see where fan is being outjected to the page so I don't know
where your id would be coming from. Are you providing a list of persons and
then the user can edit a person from the list? If you are looking to achieve a
RESTful URL here (which is the only reason I could think of for doing it this
way), an easier way to accomplish this would be...
@Stateful
| @Name("manager")
| public class ManagerAction implements Manager {
|
| @RequestParameter
| Long pid;
|
| @In (required=false) @Out (required=false)
| private Person person;
|
| @DataModel
| private List <Person> fans;
|
| @Factory(value="person")
| public void loadPerson(Long pid) {
| if (pid != null) {
| person = (Person) em.find(Person.class, pid);
| } else {
| person = new Person ();
| }
| }
| ...
|
Also note that you will not be in the same conversation when the Person is
loaded because you are using a general link <a href ...>. Any conversation
state will not be propagated. Hope that helps.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090375#4090375
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090375
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user