but I don't want to use any framework/tool.
Is there any way to generate some token programatically and send/redirect the url with that token to get the content without prompting for username/password ?
can I get any such sample java/jsp code ?
This what you want to do by yourself, in practice, is what JBoss SSO does for you.
Maybe looking at the sourcecode could help you. This should help you have some good ideias.