I have problem with my h:commandButton \"Login\": when I use @ViewScoped and push this button there is ViewExpiredException, but when I use @SessionScoped, there isn\'t any
Your concrete problem is caused because your view scoped bean is not serializable and hence MyFaces is not able to save it in the view state. MyFaces by default serializes the whole state in session instead of just referencing the state in session and having the container to serialize it if necessary.
There are basically 2 solutions:
Let your view scoped bean implement Serializable.
Tell MyFaces to not serialize the whole view state in session.
org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
false
Note that the view scoped bean will still be lost whenever you restart the server.