The subject of this posting is completely wrong - logging in to a servlet container via j_security_check has nothing to do with a User Portlet.
Anyways, I answered this question here:
Hope it helps you.
As per the instructions given by you in the link are working fine.
I have configuerd login page but not logout.
As per your code, redirection to the logout page is done at view.jsp that is the redirected page from login page.
But after click the link logout in user portal the control will not go the same page as for login link.
Then how and where can redirect to the logout.jsp
did you create logout.jsp in 'jboss-portal.sar\portal-server.war\' directory?
If so, your login.jsp can contain code like this for getting the user back into the flow of your portal/web-app:
<% session.invalidate(); response.sendRedirect("http://myserver.com:8080/login/logout.jsp"); %>
Hope this helps.