Skip to main content

How to debug action method not being called in command button

7 replies [Last post]
absmiths
Offline
Joined: 2006-08-12
Points: 0

I am using Glassfish v3 which I believe uses Mojarra 2.0.2. I have deployed a simple page which holds a single data table (it is primefaces, but I changed it to h:dataTable and it behaves the same way) which displays a list of wrapped objects and has a delete callback on each object. This is what the view looks like:

ID
#{entity.id}

Action

The beanService.actorsForClientList method returns the result of an EJB query, with each object wrapped in this wrapper class:

public class SCDEntityWrapper {
private final SCDEntity scdEntity;
private final DimensionSession.IRemote dimensionSession;

public Long getId() {
return scdEntity.getId();
}

public SCDEntityWrapper(SCDEntity entity, DimensionSession.IRemote remote)
{
scdEntity = entity;
dimensionSession = remote;
}

public String delete()
{
dimensionSession.remove(scdEntity);

return "list.jsf?faces-redirect=true";
}
}

So, here is the kicker. I use this list on two separate pages, and one works and one doesn't. The only difference I can tell is the type of entity the wrapper holds. So, I put a breakpoint in the delete method and in the case which doesn't work the method is never called at all - it just reloads the current page instead of even trying to call delete. The deleteAction is a composite component which simply adds a commandButton.

So, my question is, how can I debug why the delete method is being called? I am quite proficient at servlet/jsp programming, but this particular issue has been nagging at me for a few days and I can't figure out the next step.

Message was edited by: absmiths

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
absmiths
Offline
Joined: 2006-08-12
Points: 0

I think I figured this one out. The page in question had a parameter on the URL, that was not being preserved by the command link. The failure was coming when the page was trying to reconstruct the view I guess because the parameter was not there it could not rebuild the tree. I hard-coded the value list to return a list without regard to the parameter and it worked. So, now I need to figure out how to make forms work with URL parameters.

Ed Burns

>>>>> On Fri, 19 Mar 2010 21:02:45 -0700 (PDT), webtier@javadesktop.org said:

ABS> I think I figured this one out. The page in question had a
ABS> parameter on the URL, that was not being preserved by the command
ABS> link. The failure was coming when the page was trying to
ABS> reconstruct the view I guess because the parameter was not there it
ABS> could not rebuild the tree. I hard-coded the value list to return
ABS> a list without regard to the parameter and it worked. So, now I
ABS> need to figure out how to make forms work with URL parameters.

This is exactly what , new in JSF 2.0, is for.

I don't have time to find an example for you right now, but I can say
it's covered in my book .

Ed

--
| edward.burns... | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

absmiths
Offline
Joined: 2006-08-12
Points: 0

That's what I was asking - how do you go about tracking down problems like this? The EJB session isn't an issue since it never gets called. The SCDEnity might be a problem, but again since the delete method never even gets called I can't see how it can be (I am using the Netbeans debugger to see if the delete method is ever called and it isn't).

And I have the exact same code on two different pages and one works and one doesn't.

Message was edited by: absmiths

absmiths
Offline
Joined: 2006-08-12
Points: 0

It's a composite component which just holds a command button. I have removed it, and it behaves the same way:




ID
#{entity.id}


Action



vesuvius
Offline
Joined: 2007-06-02
Points: 0

Since I have neither [b]SCDEntity[/b], nor [b]DimensionSession.IRemote[/b], I tried with my own classes that mimicked yours as close as I could make them (even with a nested interface by the same name).

It worked flawlessly. (I'm on GlassFish v3 with Mojarra 2.0.2)

I can't reproduce your problem... :(

Probably you'd have to debug indeed. It might be something very specific to your case.

vesuvius
Offline
Joined: 2007-06-02
Points: 0

Sorry, but what is this:

[code]

[/code]

absmiths
Offline
Joined: 2006-08-12
Points: 0

So, I turned the logging way up and I see this for the page that works:

[#|2010-03-19T13:15:34.599-0500|FINE|glassfishv3.0|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=49;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Entering InvokeApplicationsPhase|#]

[#|2010-03-19T13:15:34.665-0500|FINE|glassfishv3.0|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=49;_ThreadName=Thread-1;ClassName=null;MethodName=null;|processAction(j_idt38)|#]

My logging messages follow showing that the delete is executing. This is the one which does not work:

[#|2010-03-19T13:31:27.624-0500|FINE|glassfishv3.0|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=50;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Entering InvokeApplicationsPhase|#]

[#|2010-03-19T13:31:27.624-0500|FINE|glassfishv3.0|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=50;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Exiting InvokeApplicationsPhase|#]

So, it looks like for some reason the jsf stack thinks that there is nothing to do.