tags:

views:

47

answers:

1

Hi,

I'm having a simple form on which I want to check some basic functions - edit, delete, add. The web bean (supplier) has 4-5 attributes - id, name, surname and comment. After I load the view, I can invoke some web bean methods like add, delete and stuff. I use a simple commandButton as a submit component:

 <tr>
<td><h:commandButton action="#{supplierWB.updateSupplier}" value="#{msg.BaseData_Supplier_Submit_Update}" /></td>
 </tr>

My problem is, the method doesn't get invoked on the first submit click, but after it. On the first click the page simply gets reloaded. What would the problem be here?

Thanks, al

+1  A: 

My problem is, the method doesn't get invoked on the first submit click

Verify the generated JS code. Are you bringing custom JS code in? Which webbrowser are you using?

but after it. On the first click the page simply gets reloaded. What would the problem be here?

Verify the data loading logic. The same datamodel should be preserved in the subsequent request (of the form submit) as it was during initial display. Since you're already on JSF 2.0 and this seems to be a CRUD form, I'd suggest to use a @ViewScoped bean for this. Also verify if no conversion/validation error has occurred. Use <h:messages/> to get notified of them all.

See also:

BalusC
thanks!!! it was because of the two form tags :-)
al
Ah, good to know. Which webbrowser was you using by the way? I can't seem to recall the behaviour as you described to match any case of a nested form. Further, don't forget to mark the answer accepted if it helped in answering/solving the question/problem. See also http://stackoverflow.com/faq.
BalusC
IE 7.0.5. OK. Already did that :-)
al