[jboss-user] [JBoss Seam] - Re: HowTo: When going to a page to enter data, pull from db
saeediqbal1
do-not-reply at jboss.com
Sat Apr 21 02:30:57 EDT 2007
Problem
Now one problem was fixed that it picked up stuff from database. But if the row does not exist, and then when i put stuff in the form and say save/submit ... it saves blank values. nothing null
This is what my xhtml page has at the bottom. Basically it was all generated by seam-gen (should i stop using seam-gen?)
<h:commandButton id="save"
| value="Save"
| action="#{activityHome.persist}"
| disabled="#{!activityHome.wired}"
| rendered="#{!activityHome.managed}"/>
|
| <h:commandButton id="update"
| value="Save"
| action="#{activityHome.update}"
| rendered="#{activityHome.managed}"/>
|
| <h:commandButton id="delete"
| value="Delete"
| action="#{activityHome.remove}"
| rendered="#{activityHome.managed}"/>
|
| <s:button id="done"
| value="Done"
| propagation="end"
| view="/Activityxhtml"
| rendered="#{activityHome.managed}"/>
|
| <s:button id="cancel"
| value="Cancel"
| propagation="end"
| view="/#{empty activityFrom ? 'ActivityList' : activityFrom}.xhtml"
| rendered="#{!activityHome.managed}"/>
As you can see from my previous post, my values are here #{activity.entrya} Not in #{activityHome.entrya} I dont understand whats the Home stuff.
I am pretty sure that save update delete stuff is messing my app up as it points to the activityHome
help.
While we are here. THis is what i have in my action bean
| @Out
| private Activity activity;
| @Factory("activity")
| public void actionMethod()
| {
| Activity activity= new Activity();
| try {
| activity= (Activity) em.createQuery("select o from Activity o where o.userid = :num")
| .setParameter("num", 1)
| .getSingleResult(); // the 1 number is temporary will change it
| }
| catch (NoResultException ex) {
| FacesMessages.instance().add("Enter new activity record.");
|
| }
|
| if(activity!= null){
| setActivity(activity);
| }
| }
|
|
Scope is event and it is stateless.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039500#4039500
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039500
More information about the jboss-user
mailing list