aspose file tools*
The moose likes JSF and the fly likes button or link action not executed inside dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "button or link action not executed inside dataTable" Watch "button or link action not executed inside dataTable" New topic
Author

button or link action not executed inside dataTable

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi everyone

I have a problem with commandButton or link inside dataTable tag with a backing bean in request scope.

I know the problem is the request scope but I would like to not change it to session scope. I read from several sun forum discussion to use a4j or tomahawk

<a4j:keepAlive> <t:saveState> or <t:dataTable preserveDataModel="true">

Isn't there any other way to just use the regular JSF h or f tags to achieve the same thing?

Also, can someone give code example on how to preserve DataModel, I apparently have not have much success to do it in the java code.
or any link or anything.

Thanks in advance
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Here is an example how to use a4j:keepAlive: http://mkblog.exadel.com/jsf/view-scope-in-richfaces/

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey thanks Max for your blog

Can I use ajax4Jsf with just a plain JSF implementation or do I have to use RichFace?

Also I would like to point out that your blog althought it's nice but I am not certain it address my problem because your add button is outside of dataTable tag.

But anyways, thanks for your input. Does anyone else know solutions for plain JSF implementation?

Thanks
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
If you use a4j:keepAlive, then you will be using RichFaces. RichFaces is not a replacement for JSF, it's a framework on top of JSF. It doesn't matter if the link is inside or outside the table, a4j:keepAlive gives you page scope which means that as long as you stay on the same page, the bean will be available (event though it's in request scope).

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Can you tell me or point me to what resource I need to implement ajax4JSF with JSF 1.1 and can it work with JSF 1.1 or would I need to upgrate to 1.2?

I would like to know what jar files I need and also the syntax for the <filter> entries in DD

Is there a tutorial page to help me set up this tag library?

Thanks so much for your reply
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Yes, it should work with JSF 1.1, I think you need RichFaces 3.1.x branch.

You will find all the information here: http://www.jboss.org/richfaces

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey Max

There is an error on the page you gave me, it prevented me from downloading the binaries. (I see a triangular warning sign from the lower left hand corner of my IE)

Can you provide me with other page that works?

Thanks
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
It works for me or just go to http://www.jboss.org and find RichFaces project.
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

Hi Davie Lin,

you can use the ibm's datatableEx component which is successfully working for me.
I used command button inside the datatable with scope request and working fine.

could you explain what the exact problem you are facing?


Sun Certified Java Programmer with 93 percent
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi Suresh

My backing bean's edit() method was never called when I click the commandButton imbeded inside dataTable tag

my backing bean was in request scope and I would like to keep it in request scope. I current use JSF 1.1 and would like to upgrade to JSF 2.0
but seems like JSF 1.2 and 2.0 doesn't work on Tomcat 5.5, has to be Tomcat 6.0

Can you tell me more about this IBM implementation?

Thanks appreciated
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey Max

The ajax4jsf library's keepAlive works awesome

the backing bean's method is fired as expected. I still use JSF 1.1 implementation. I also use the a4j:commandButton instead of the old h:commandButton, the reason is I need the a4j's oncomplete() JS attribute to fire the backing bean method first before calling a modal pop-up window. However, my pop-up window didn't show the value from my backing bean's method. wonder what I did wrong in the backing bean's method. The purpose of this pop-up window is to edit that particular row from the list.

any thougths?
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Post your code.

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Cool, here it goes

Main Facelet page



Backing bean Functionality View in request scope



here is the pop-up facelet



I have yet to implement a update, cancel and close button at the end of the pop-up window. Right now I just want to make sure the pop-up pre-populate the form field from

BTW, dynamicFunctionality is my POJO, I figure it's simple enought that I don't need to include it and I also make my code a lot shorter, I didn't post everything so that way it's easier for you to read, only posted relvent information here.

Thank you so much for analysis
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
It doesn't work because you do a GET in the popup window - there is no state to restore. You should use rich:modalPanel instead.

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
There is a session bean associated with my request bean by using JSF's IoC, this session bean access my Spring layer, would it work if I have my pojo in this session bean?

What about creating another request bean with the same member as the first requst bean? does the rich:modalPane available in 3.1.6? I found a different site to download richface,

Yes, it should work with JSF 1.1, I think you need RichFaces 3.1.x branch.
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
When you do a GET, you get a new session
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Looks like I need to look into this rich:modalPanel

would you mind send me a link for this rich:modalPanel's documentation?

Thanks again
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Everything RichFaces is here: http://www.jboss.org/richfaces

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Thanks, I have downloaded rich face 3.1.6

Just one other quick question, does this already include the ajax4jsf1.1.1.jar or should I just keep that jar along with the 3 jar from richface?
Would I also need to have 2 <filter> entries in DD if I want both a4j and rich tags?

thanks again

p.s. I think you should be at least a Ranch Hand status, althought you just signed up to this site
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
No, you don't need anything besides the 3 Jar files. Go to docs directory, there is a PDF file, page 23 shows you how to configure this particular RichFaces version, it's very simple.

Max
http://mkblog.exadel.com
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
I follow that page and took out ajax4jsf1.1.1.jar because it was failing to startup the app, so after that's taking out it was fine to start
but I can't log in, after I click the login button it just refresh the page, that's so strange

The eclipse console show no error or nothing, I don't know what to do
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Make sure there are no conversation/validation errors (place h:messages on the page) and/or navigation is defined correctly.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
ok, I will try that tomorrow, except this app I inherited did not use <navigation> the previous employee wrote a navigation class to handle navigation.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Still have not getting any error message from <h:message /> tag, plus I but a break line in debugger and the backing login method is not getting called. What a disconnect
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
Try h:messages
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
I have <h:messge> it return nothing, but however, after couple hours of digging thru google, I think I found the issue.

Yesterday I downloaded Richface version 3.1.6 and apparently, someone had the same issue of form not getting submitted, meaning backing bean method not getting executed.

This version of richface does not work with JSF 1.1_01, this person downgrade it to richface 3.1.5 and worked fine

Richface 3.1.6 issue

and I just checked my JSF implementation from the jar file, it is 1.1_01

so I am gonna downgrade to richface 3.1.5 and hope it works great, I will report back the result
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Ok, Richface 3.1.5 solved the form submit issue, That was wonderful, but does that mean I can resume what I was doing before? NO

Now my logout link has disappear now, this log out link is in my default layout template I have so far try using a4j:commandLink

still not available yet, issues after issues

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Oops, my bad

I forgot to set my login bean back to session scope, that was my problem, and such a minor problem, too.



Anyways, I guess I can resume with what I was doing now. what a huge relief.

Thanks for reading thru all this rant.. appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: button or link action not executed inside dataTable