facebook

myfaces no valid constructor error saving state on client

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #246229 Reply

    xtlb43n
    Member

    I’m using myFaces; when I set the state_saving_method to client in faces-config.xml, I’m receiving an error ‘no valid constructor’ (when state is set to save on the server everything works fine); The backing bean does have ‘implements Serializable’ – this is the only change I made to support saving state on the client. I am doing some variable initialization within the constructor for the backing bean which may be why I’m receiving the error.

    I don’t have experience with implementing serializable on my java classes – can anyone help me understand the issue and possibly point me to any good reference JSF material for how to code / configure the app to support saving state on the client?

    Also, what is everyone’s experience regarding saving state on the client vs. the server? I’ve heard client is slower? Is memory impact to server a risk (note: I would be storing database search results in the state).

    thanks

    #246244 Reply

    Riyad Kalla
    Member

    I am doing some variable initialization within the constructor for the backing bean which may be why I’m receiving the error.

    Do you have a default no-arg constructor? If not, add one, see what happens.

    Also, what is everyone’s experience regarding saving state on the client vs. the server? I’ve heard client is slower? Is memory impact to server a risk (note: I would be storing database search results in the state).

    I tend to use server but we also tend to have beefy servers and I have to be good about clearing session state and results.

    Moving to OT > Soft Dev for community input.

    #246253 Reply

    xtlb43n
    Member

    “I have to be good about clearing session state and results. ”

    via session settings on the server or in the code? if in the code, can you please point me to any documentation / examples about how & when to clear session information?

    also, thanks for moving to the other community – I wasn’t sure if this was the appropriate place – I will post s/w dev questions there.

    thanks.

    #246256 Reply

    Riyad Kalla
    Member

    via session settings on the server or in the code? if in the code, can you please point me to any documentation / examples about how & when to clear session information?

    There are a lot of thoughts on this, but it boils down to common sense really. Most folks suggest search results stay in the request, never in the session (Because of their size). But write your search query that if a user book marks search results, that it can be re-run and give approximately the same results back. Don’t worry about EXACT results. (for example, if you bookmarked the search result of “java” for google, then visited a month later the results are different).

    So a rule of thumb is, put everything in the request that you don’t need to represent the user across a session. Stuff that should go in the session are things like your user bean that represents a logged in user, maybe some persistent settings, but everything else like page contents, search results and the like should go in the request, get rendered and then thrown out. If you need them again, requery them from the DB.

    #246260 Reply

    xtlb43n
    Member

    thanks

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: myfaces no valid constructor error saving state on client

You must be logged in to post in the forum log in