Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[JSF]RowAction not working properly  RSS feed

 
Marco Tulio Borges
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I still have other two problems without solution and I got myself another one: a RowAction from a Datatable.

I have a <h :datatable> and it has a <hx:commandExRowAction> (from <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%> - at this point you already know I'm using IBM's implementation for JSF). Well, the thing is: the first time I click on a row from the <h :datatable> the action returns the right index from the row that was clicked. Then, everytime I click any row in the table, this rowActionObject.getRowIndex(); always return the same index... Say: I click on the 3rd row. The rowActionObject.getRowIndex(); call returns 2. Then I click on the 5th row. I still have a rowActionObject.getRowIndex(); returning 2. Then I restart the server (or start again my browser - in other words: start working in another session) and click on the 17th row of the table. The rowActionObject.getRowIndex(); call returns 16. Then I click on the 2nd row of the table and I still get 16 as my return.

Why does it happen??

Here's a part of my faces-config.xml file:

faces-config.xml sample:

<managed-bean>
<managed-bean-name>pc_PageWithDataTable</managed-bean-name>
<managed-bean-class>packages.pagecode.PageWithDataTable</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>


Editted to put some stuff between [B] tags
[ January 05, 2005: Message edited by: MTulio Borges ]
 
Marco Tulio Borges
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this problem I found the answer....

Just put a

rowActionObject.setTransient(true);


before start using the RowAction object

 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by MTulio Borges:
For this problem I found the answer....

Just put a

rowActionObject.setTransient(true);


before start using the RowAction object





what is your
javax.faces.STATE_SAVING_METHOD variable in web-xml?
[ January 06, 2005: Message edited by: K Varun ]
 
Marco Tulio Borges
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What??

What does the javax.faces.STATE_SAVING_METHOD variable do?

Here's my web.xml:



Editted to try to format the web.xml
[ January 06, 2005: Message edited by: MTulio Borges ]
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okey,

JSF uses the variable "javax.faces.STATE_SAVING_METHOD" variable to determine where to save the JSF application state. Possible values are "client" or "server". Default is "client".

From JSF specification -->

JSF implementations support two primary mechanisms for saving state, based on the
value of the javax.faces.STATE_SAVING_METHOD initialization parameter (see
Section 10.1.3 ´┐ŻApplication Configuration Parameters´┐Ż). The possible values for this
parameter give a general indication of the approach to be used, while allowing JSF
implementations to innovate on the technical details:
1) client -- Cause the saved state to be included in the rendered markup that is sent
to the client (such as in a hidden input field for HTML). The state information
must be included in the subsequent request, making it possible for JSF to restore
the view without having saved information on the server side.
2) server -- Cause the saved state to be stored on the server (perhaps by being stored
in a servlet or portlet session) in between requests.


By setting the variable property "transient" as true - you have ensured that this component must not be included in the state of the component tree.
 
Marco Tulio Borges
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx! I didn't know it! But, still... Something happened... The setTransient(true) that worked before, seems not to be working now... The initial problem seems to continue... What could it be? And, what is the best choice for my problem: saving the app state on the client, on the server or it doesn't matter for this problem?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our brand new JSF Forum...
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by MTulio Borges:
Thanx! I didn't know it! But, still... Something happened... The setTransient(true) that worked before, seems not to be working now... The initial problem seems to continue... What could it be? And, what is the best choice for my problem: saving the app state on the client, on the server or it doesn't matter for this problem?


You should go for "client" side saving if you are planing to go for distributed deployment(since you haven't specified in faces-config, so it's client_side_save (default one) only for you)

But, I don't think this should cause you any problem. Not sure though.


P.S. if your backing bean is in request scope, and you are using command link inside datatable, with your rowaction being a child of the commandlink, then this can be a bug. I haven't experienced this, but read a lot about in Sun forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!