Hi I solved it.
It just have to Implement the security check in a servlet and add URL to that servlet into the form's action field with a parameter that represent URL to the page that you want to be the next page after log on. Then in the security check servlet reads username, password and nextPageURL and do the necessary operation with them.
Thanks Mallikarjun your comment was helped me.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How specify the next page after form log on.