If your current userId is bound to h:outputText in your viewUser.jsp, then it won't get back to your viewUserBean during request submit and the value will be lost. It seems that you are just displaying the UserId in viewuser.jsp and hence it is not persisting between requests. I could see a couple of approaches to this problem
You can store the userId as a session attribute and then retrieve it for the next request from your viewUserBean. This would need some additional code in your bean.
If you are using
JSF 2.0 or higher, your viewuserbean is a very good candidate for @ViewScoped Bean. The bean stays as long as you are on the same page, that is on viewuser.jsp. Once you are done with viewuser.jsp and navigate to some other page of your application the bean will go out of scope.
regards,
Nirvan.