You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Jung <ma...@prismtech.com> on 2005/02/10 15:39:00 UTC

commandLink problem

I am not sure if this is related to the other commandButton discussions 
or not,
but I have a similar problem using actions and commandLinks.

The attached jsp file shows one case where an action is successfully 
executed if a link is clicked
and another case where the action and the navigation afterwards is not 
executed.
The same page is displayed again. The only difference is the commandLink 
is part of a dataTable.

I am not sure if there is a mistake by my side or could be a bug within 
the MyFaces implementation.

Any idea?

Thanks Matthias

Re: commandLink problem

Posted by Matthias Jung <ma...@prismtech.com>.
Hey, I found the reason :-)

I just changed the lifecycle of the ApplicationListBean from request to 
session.
Untill now I did not know that dataTables and 'request beans' don't like 
each other, now I know better.

Here's the explanation for all newbies like me: (Heavy printf debugging 
of my objects helped)
After clicking a the commandLink a new request is sent to the servlet.
The ApplicationListBean object is created a second time, but not in the 
way set up as the object before.
I do not understand why, but MyFaces servlet calls the 'showApplication' 
method another time. As said, now using a different bean object which 
returned an empty ArrayList.
Instead of raising an error, request processing stoped. The action I 
expected to be executed was not called.
As result page I got was the same one as before, just computed with the 
new not correctly initialized object (no values in the table).

Should MyFaces have logged anything? Or was this way of program flow 
correct from the MyFaces point of view?
Do you have tips of how to avoid running in a similar situation next time?


Best regards
Matthias


Matthias Jung wrote:

> Sean,
> the showApplication method is not being called. The log output in its 
> first line is not displayed.
> Is there a way to get some more Debug output of the MyFaces 
> implementation?
> Got to say I'm quite new to JSF and don't know which switches to turn.
>
> Cheers Matthias
>
>
> Sean Schofield wrote:
>
>> Matthias,
>>
>> I will try running your example later today when I get home from work.
>> I am pretty sure that I was able to get a command link to work in a
>> dataTable before but I can't be sure.  Your example should work.  Are
>> you able to say definitively (through either debugger or log
>> statement) that the showApplication method is not being called at all?
>>
>> I was looking at the source code (in both the RI and MyFaces) for
>> dataTable recently because I wanted to get some ideas for the tree
>> component I am working on.  At that time found myself wondering how
>> dataTable could possibly work with events, etc. the way it was
>> written.  This would be consistent with your experience.
>>
>> But I also seem to recall doing a simple example and being satisfied
>> that it was working.   I seem to recall using the <f:param> in a
>> simple example and then checking the value in my action listener and
>> being satisfied.  This is why I am asking you to verify that the
>> method is not being called (as opposed to your end result not being
>> what you expect.)
>>
>> That being said, there is some weirdness going on with dataTable
>> becayse Sylvain is having some problems with the checkbox in
>> dataTable.  I will look into all of this later tonight and report
>> back.
>>
>> sean
>>
>>
>> On Thu, 10 Feb 2005 15:39:00 +0100, Matthias Jung
>> <ma...@prismtech.com> wrote:
>>  
>>
>>> I am not sure if this is related to the other commandButton discussions
>>> or not,
>>> but I have a similar problem using actions and commandLinks.
>>>
>>> The attached jsp file shows one case where an action is successfully
>>> executed if a link is clicked
>>> and another case where the action and the navigation afterwards is not
>>> executed.
>>> The same page is displayed again. The only difference is the 
>>> commandLink
>>> is part of a dataTable.
>>>
>>> I am not sure if there is a mistake by my side or could be a bug within
>>> the MyFaces implementation.
>>>
>>> Any idea?
>>>
>>> Thanks Matthias
>>>
>>>
>>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ 
>>> taglib uri="http://java.sun.com/jsf/core" prefix="f" %> !!! This 
>>> works !!! This does not work
>>>   
>>
>>
>>  
>>
>

Re: commandLink problem

Posted by Matthias Jung <ma...@prismtech.com>.
Sean,
the showApplication method is not being called. The log output in its 
first line is not displayed.
Is there a way to get some more Debug output of the MyFaces implementation?
Got to say I'm quite new to JSF and don't know which switches to turn.

Cheers Matthias


Sean Schofield wrote:

>Matthias,
>
>I will try running your example later today when I get home from work.
> I am pretty sure that I was able to get a command link to work in a
>dataTable before but I can't be sure.  Your example should work.  Are
>you able to say definitively (through either debugger or log
>statement) that the showApplication method is not being called at all?
>
>I was looking at the source code (in both the RI and MyFaces) for
>dataTable recently because I wanted to get some ideas for the tree
>component I am working on.  At that time found myself wondering how
>dataTable could possibly work with events, etc. the way it was
>written.  This would be consistent with your experience.
>
>But I also seem to recall doing a simple example and being satisfied
>that it was working.   I seem to recall using the <f:param> in a
>simple example and then checking the value in my action listener and
>being satisfied.  This is why I am asking you to verify that the
>method is not being called (as opposed to your end result not being
>what you expect.)
>
>That being said, there is some weirdness going on with dataTable
>becayse Sylvain is having some problems with the checkbox in
>dataTable.  I will look into all of this later tonight and report
>back.
>
>sean
>
>
>On Thu, 10 Feb 2005 15:39:00 +0100, Matthias Jung
><ma...@prismtech.com> wrote:
>  
>
>>I am not sure if this is related to the other commandButton discussions
>>or not,
>>but I have a similar problem using actions and commandLinks.
>>
>>The attached jsp file shows one case where an action is successfully
>>executed if a link is clicked
>>and another case where the action and the navigation afterwards is not
>>executed.
>>The same page is displayed again. The only difference is the commandLink
>>is part of a dataTable.
>>
>>I am not sure if there is a mistake by my side or could be a bug within
>>the MyFaces implementation.
>>
>>Any idea?
>>
>>Thanks Matthias
>>
>>
>><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
>> !!! This works !!! 
>> This does not work 
>>
>>    
>>
>
>  
>

Re: commandLink problem

Posted by Sean Schofield <se...@gmail.com>.
Matthias,

I will try running your example later today when I get home from work.
 I am pretty sure that I was able to get a command link to work in a
dataTable before but I can't be sure.  Your example should work.  Are
you able to say definitively (through either debugger or log
statement) that the showApplication method is not being called at all?

I was looking at the source code (in both the RI and MyFaces) for
dataTable recently because I wanted to get some ideas for the tree
component I am working on.  At that time found myself wondering how
dataTable could possibly work with events, etc. the way it was
written.  This would be consistent with your experience.

But I also seem to recall doing a simple example and being satisfied
that it was working.   I seem to recall using the <f:param> in a
simple example and then checking the value in my action listener and
being satisfied.  This is why I am asking you to verify that the
method is not being called (as opposed to your end result not being
what you expect.)

That being said, there is some weirdness going on with dataTable
becayse Sylvain is having some problems with the checkbox in
dataTable.  I will look into all of this later tonight and report
back.

sean


On Thu, 10 Feb 2005 15:39:00 +0100, Matthias Jung
<ma...@prismtech.com> wrote:
> I am not sure if this is related to the other commandButton discussions
> or not,
> but I have a similar problem using actions and commandLinks.
> 
> The attached jsp file shows one case where an action is successfully
> executed if a link is clicked
> and another case where the action and the navigation afterwards is not
> executed.
> The same page is displayed again. The only difference is the commandLink
> is part of a dataTable.
> 
> I am not sure if there is a mistake by my side or could be a bug within
> the MyFaces implementation.
> 
> Any idea?
> 
> Thanks Matthias
> 
> 
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
>  !!! This works !!! 
>  This does not work 
>