I split up your code tags to make your post easier to read.
Your first code snippet obviously will not work because you are not setting a value for "id".
Did you check the HTML in the browser to see if your code is correctly getting the ID from the action?
Why are you checking the request for the parameter rather than using an action attribute? Also, why are you calling the attribute "userId" in one request then "id" in the next?