myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim May <jim.webg...@gmail.com>
Subject Re: Jsf Hibernate problem in SelectOneList event
Date Thu, 31 Jan 2013 01:23:41 GMT
Couple of things I noticed:

1) action method is typically used for returning string for jsf navigation.
I have encounter weird issues sometimes with JSF when I use action method
as something else than a method called for custom logic with navigation.

Give ActionListener a try to see what happens.

2) Was the netbeans debugger used at all?? Try debugging the app and put
break points in each of the methods so that you can see what is happening.

3) Does session scoped have to be used?? Try using a limited scope such as
ViewScoped when you don't need to have session scoped objects.

Jim
On 30/01/2013 14:05, Giri Prasad wrote:

> Hello All,
>
>   I have a very simple jsf page and a backing bean for this jsf, which is
> implemented in hibernate using Netbeans.
>
>   <Select> button does properly populate the list box. <Details> button
> does display the debug message in glassfish log, when no entry in list box
> is chosen.
>
>   After I press <Select>, choose a entry from the list, pressing <Detail>
> button, is not executing the backing bean function 'studDet()'. On this
> situation, the screen just refreshes, the list goes empty, and the backing
> bean function is not executed.
>
>   The same backing bean function ['studDet()']  is executed when nothing
> is selected from the list. Apparently the logic when implemented via jpa
> seems to work just perfectly correctly.
>
> Can any one provide your insights, as why this problem is occuring. Thanks
> in advance.
>
I recently had a problem with jsf+hibernate, with another control from the
selectOneXXX family (see http://forum.primefaces.org/**
viewtopic.php?f=3&t=27919#**p88162<http://forum.primefaces.org/viewtopic.php?f=3&t=27919#p88162>and
later)

My problem was that I was comparing "real" objects and "hibernate proxy"
objects. The standard java equals function just fails in this case. I do
not see how you fetch your objects, but this might be the case.

Your problem might also be simplier. I am also a bit surprised that you
return a list of SelectItem as value for your f:selectItems.

Let say that you have a Student type.
You will then have a

    List<Student> getStudentList()

method and a custom Converter to propertly manage the String <-> Object
mapping.

Your selectedItem property should in this case also be of Student type.


Hope this helps,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message