Table Button Action - never executes

Hey Everyone, I have a really strange problem.

I have a table, which is bound to an ObjectArrayDataProvider. Everything works fine. I then added a command button to one of the colums and bound its action property to the backing bean.

The problem is; when ever I click the button - the code is never executed.

<ui:button action="#{Monitor.button_Remove_action}" binding="#{Monitor.button_Remove}" id="button_Remove" text="Remove"/>

public String button_Remove_action(){

/*

* Never reaches this code

*

*/

doAmazingThings(true);

returnnull;

}

[939 byte] By [AdamSon] at [2007-11-26 9:36:14]
# 1
Put a message group component on the page. Do any messages appear in the message group component when you click the button?
vspurlin at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 2

I just tried - no :(

I don't know what could be causing this. I feel there is a problem with my JSP. For example a tag not being closed. I obviously have checked that, as well; Creator would not allow me to view in Design mode with such a serious problem.

Any one else have any suggestions?

AdamSon at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 3

Action methods don't get called if there are conversion errors, validation errors, or exceptions such as null pointer or class cast errors. Try this: Right-click Deployment Server and choose View Server Log. Then run the program and watch the server log after clicking the button. See if the log spews out any error messages.

vspurlin at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 4
I have other buttons NOT in the table that work fine.
AdamSon at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 5

Can you do the following to verify that there isn't a valid reason for this particular action method not being called:

Right-click Deployment Server and choose View Server Log. Then run the program and watch the server log after clicking the button. See if the log spews out any error messages.

MrsJetsons at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 6
Confirmed: Server Log is clean.Anyone?
AdamSon at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 7
I am perplexed. Are you using virtual forms? Not that that would explain it.Do you have the immediate property set to true (checked) for any component?Do you bypass any phases by calling renderResponse() or responseComplete()?
MrsJetsons at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 8

> I am perplexed. Are you using virtual forms? Not

> that that would explain it.

>

> Do you have the immediate property set to true

> (checked) for any component?

>

> Do you bypass any phases by calling renderResponse()

> or responseComplete()?

No, No and No.

I have brought the page down to my 1 table with 1 rowgroup with 1 column containing the 1 button.

Still no go!

I am dynamically populating the table, if that would matter? In prerender I set the array:

objectArrayDataProvider1.setArray(getServers());

AdamSon at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 9

I just tried that and it worked ok for me.

Now I am very curious as to what the problem could be. On the tutorials page (http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/inde x.jsp) is a feedback alias. Using that email address, can you send your project to me? What I probably need is the <page>.jsp, <page>.java, SessionBean1.java, and any other supporting .java sources.

MrsJetsons at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 10
Unfortunately I work for a rather large corporation in which frowns on me publicly releasing their IP :)I may end up just trashing the page, completely; and start over again from scratch. There has to be something small somewhere!
AdamSon at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 11
We understand, since we also work for a large corporation that is quite careful about IP. If you can start from scratch and create the simplest example that reproduces the problem, perhaps you can then send MrsJetsons step by step directions without sending actual source code.
vspurlin at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 12

Hi there,

Did you find a solution to this?

Does your button have an onClick java script action?

I have a problem where my buttons are not performing their actions properly because the seem to perform the java script first.

Anyone know how to force the button action first? I've tried immediate.

Thanks very much,

Emma

EmmaWykes at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 13
Not sure but maybe setting timeout like in http://blogs.sun.com/divas/entry/disabling_a_button_after_it will help
jetsons at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 14

Hi Jetsons,

Thanks for that. I'm likely overlooking someting but I'm not sure that that helps with our particular problem.

What I need to do is force the button action befre the java script somehow. In 2 different cases I need to perform an action before the script.

Either that or somehow open a new window (with specified size), or close a window in our Java....is that possible? If so, Id really appreciate it if you could let me know what the code might be.

Thanks again,

Emma

EmmaWykes at 2007-7-7 0:28:08 > top of Java-index,Development Tools,Java Tools...
# 15
The entry at http://blogs.sun.com/divas/entry/disabling_a_button_after_it causes the button to be disabled after the action method is executed. So it seems like you should give it a try. The timeout is the key
jetsonsa at 2007-7-21 15:18:55 > top of Java-index,Development Tools,Java Tools...
# 16

Thanks again Jetsons,

I'm still confused. I've done as you suggested. Since I had replace my onClick event with the code you directed me to, which disables the button, I moved my window.open command to onMouseUp (I wasn't sure what else I could do with it, since I need to open a new window with specified size.)

Anyway, what's happening now is that you can open the first popup (product detail) - which comes up correctly. Then I can click on other products which as show as the same (original) product until I click in the original product again, at which point the product detail changes to the second one I clicked on.

Very confusing.

Emma

EmmaWykesa at 2007-7-21 15:18:55 > top of Java-index,Development Tools,Java Tools...
# 17

> I'm still confused. I've done as you suggested.

> Since I had replace my onClick event with the code

> you directed me to, which disables the button, I

> moved my window.open command to onMouseUp (I wasn't

> sure what else I could do with it, since I need to

> open a new window with specified size.)

>

Yes, you are confused. I was not telling you to copy everything. I was pointing out this blog as an example of proof the you can make the javascript happen after the form is submitted (after the form is submitted it goes to the server which starts the lifecycle phases, one of which is to execute the action method). If you want your JavaScript to be executed after the form is submitted, try using the timeout like I did in the blog.

> Anyway, what's happening now is that you can open the

> first popup (product detail) - which comes up

> correctly. Then I can click on other products which

> as show as the same (original) product until I click

> in the original product again, at which point the

> product detail changes to the second one I clicked

> on.

>

Perhaps you should create a new post and describe in better detail what you want to accomplish and show your JavaScript code. Maybe a JavaScript expert can help you.

As this is a general HTML/JavaScript question -- how to get the JavaScript to take place after a form is submitted, you might have better luck in a JavaScript forum.

Good Luck

Chris

jetsonsa at 2007-7-21 15:18:56 > top of Java-index,Development Tools,Java Tools...
# 18
Thanks, I'll try that.
EmmaWykesa at 2007-7-21 15:18:56 > top of Java-index,Development Tools,Java Tools...