need help editing a row of data.

2007-02-26 Thread Mick Knutson

I have a dataTable that has a list of users:

   
   
   
   
   

   [
   
   

]


When I click this link, I get sent to
com.baselogic.tro.user.impl.UserActionListener.processAction:

   public void processAction(ActionEvent anEvent)
   throws AbortProcessingException {
   log.info("++");
   log.info("processAction(ActionEvent anEvent)");
   log.info("++");

   User tmpUserBean = null;

   UIComponent tmpComponent = anEvent.getComponent();

   while (null != tmpComponent && !(tmpComponent instanceof UIData)) {
   log.info
("---while--");
   tmpComponent = tmpComponent.getParent();
   }

   if (tmpComponent != null && (tmpComponent instanceof UIData)) {
   Object tmpRowData = ((UIData) tmpComponent).getRowData();
   if (tmpRowData instanceof User) {
   tmpUserBean = (User) tmpRowData;

   //TODO Implementation of your method
   log.info
("++");
   log.info("tmpUserBean.toString(): " + tmpUserBean.toString
());
   log.info
("++");

   }
   }

   //TODO Exception Handling if UIData not found or tmpRowBean of wrong
type


tmpUserBean prints the row I was expecting, but now I do not know how to get
tmpUserBean in the request and sent back to userDetail.xhtml


--
---
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/djmick_dot_com
http://www.thumpradio.com
---


Re: need help editing a row of data.

2007-02-26 Thread Simon Kitching

Mick Knutson wrote:



tmpUserBean prints the row I was expecting, but now I do not know how to 
get tmpUserBean in the request and sent back to userDetail.xhtml


What do you mean by "sent back to userDetail.xhtml"?

Note that the h:commandLink tag can take an actionListener *attribute* 
as an alternative to using an f:actionListener child. The attribute form 
is an EL expression, ie can point to a method on your normal backing 
bean, which I find far more useful than an independent ActionListener class.


Regards,

Simon


Re: need help editing a row of data.

2007-02-26 Thread Mick Knutson

i display a table of users on listUsers.xhtml

Then I want to click the username link and open the selected user in that
row on editUser.xhtml so I can edit that user.






On 2/26/07, Simon Kitching <[EMAIL PROTECTED]> wrote:


Mick Knutson wrote:

>
> tmpUserBean prints the row I was expecting, but now I do not know how to
> get tmpUserBean in the request and sent back to userDetail.xhtml

What do you mean by "sent back to userDetail.xhtml"?

Note that the h:commandLink tag can take an actionListener *attribute*
as an alternative to using an f:actionListener child. The attribute form
is an EL expression, ie can point to a method on your normal backing
bean, which I find far more useful than an independent ActionListener
class.

Regards,

Simon





--
---
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/djmick_dot_com
http://www.thumpradio.com
---


Re: need help editing a row of data.

2007-02-26 Thread Mick Knutson

I also tried this:

http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters


then I have this method:

   public String prepareForEdit(){
   log.info
("++");
   log.info
("++");
   log.info
("++");
   log.info
("++");
   log.info("UserBackingBean.prepareForEdit(String)");
   log.info("UserBackingBean.user.username(): " + user.getUsername());

   String outcome = Constants.FAILURE;

   try {
   user = manager.getUser(user.getUsername());

   log.info
("++");
   log.info("user.toString(): " + user.toString());
   log.info
("++");

   outcome = Constants.EDIT;

   } catch (Exception e) {
   outcome = Constants.FAILURE;
   FacesContext.getCurrentInstance().addMessage(null,
   new FacesMessage(e.getMessage()));
   e.printStackTrace();
   return(null);
   }
   return outcome;
   }



but then when I get redirected to the editUser.xhtml page, the form is
blank.

I even added:


as all the mangedBean's are request scope but I can't seem to populate the
editUser form with data.




On 2/26/07, Simon Kitching <[EMAIL PROTECTED]> wrote:


Mick Knutson wrote:

>
> tmpUserBean prints the row I was expecting, but now I do not know how to
> get tmpUserBean in the request and sent back to userDetail.xhtml

What do you mean by "sent back to userDetail.xhtml"?

Note that the h:commandLink tag can take an actionListener *attribute*
as an alternative to using an f:actionListener child. The attribute form
is an EL expression, ie can point to a method on your normal backing
bean, which I find far more useful than an independent ActionListener
class.

Regards,

Simon





--
---
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/djmick_dot_com
http://www.thumpradio.com
---


Re: need help editing a row of data.

2007-02-26 Thread Mike Kienenberger

Solution to this issue (using t:updateActionListener and t:saveState)
posted on the previous thread "t:datatable with commandLink and
parameter "

On 2/26/07, Mick Knutson <[EMAIL PROTECTED]> wrote:

I also tried this:

http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters


then I have this method:

public String prepareForEdit(){

log.info("++");

log.info("++");

log.info("++");

log.info("++");
log.info("UserBackingBean.prepareForEdit (String)");
log.info("UserBackingBean.user.username(): " + user.getUsername());

String outcome = Constants.FAILURE;

try {
user = manager.getUser(user.getUsername ());


log.info("++");
log.info("user.toString(): " + user.toString());

log.info("++");

outcome = Constants.EDIT;

} catch (Exception e) {
outcome = Constants.FAILURE;
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage( e.getMessage()));
e.printStackTrace();
return(null);
}
return outcome;
}



but then when I get redirected to the editUser.xhtml page, the form is
blank.

I even added:


as all the mangedBean's are request scope but I can't seem to populate the
editUser form with data.




On 2/26/07, Simon Kitching <[EMAIL PROTECTED]> wrote:
> Mick Knutson wrote:
>
> >
> > tmpUserBean prints the row I was expecting, but now I do not know how to
> > get tmpUserBean in the request and sent back to userDetail.xhtml
>
> What do you mean by "sent back to userDetail.xhtml"?
>
> Note that the h:commandLink tag can take an actionListener *attribute*
> as an alternative to using an f:actionListener child. The attribute form
> is an EL expression, ie can point to a method on your normal backing
> bean, which I find far more useful than an independent ActionListener
class.
>
> Regards,
>
> Simon
>



--
---
Thanks,
Mick Knutson

 http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/djmick_dot_com
http://www.thumpradio.com
---