- This topic has 4 replies, 2 voices, and was last updated 18 years, 10 months ago by xtlb43n.
-
AuthorPosts
-
xtlb43nMemberI’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
Riyad KallaMemberI 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.
xtlb43nMember“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.
Riyad KallaMembervia 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.
xtlb43nMemberthanks
-
AuthorPosts