This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session Tracking in Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Tracking in Servlets" Watch "Session Tracking in Servlets" New topic
Author

Session Tracking in Servlets

gowrishankar sundararajan
Greenhorn

Joined: Apr 10, 2007
Posts: 6
hi all,
i am learning servlets and to learn about session tracking.
i would like to know first how to do authentication.
i tried

which is always null.
i dont want to use the timcat-users.xml and then authenticate.
we have some server with which i always login to computer in our network.
now when i write a servelt and put these two lines i get a popup but after giving the credentials i am not able taken forward.

can you tell me what should be done?
gowrishankar sundararajan
Greenhorn

Joined: Apr 10, 2007
Posts: 6
can i get some answers for this question???
Ramu Pamidimarri
Greenhorn

Joined: Jun 29, 2007
Posts: 2
Hi you can do the authentication 4 types:-
oHTTP Basic authentication ( BASIC )
oHTTP Digest authentication (DIGEST)
oHTTPS Client authentication (CLIENT-CERT)
oHTTP FORM-based authentication (FORM)


<form method="POST" action="j_security_check">
<input type="text" name="j_username">
<input type="password" name="j_password">
<input type="submit" value="OK">
</form>

entry in web.xml:-

<web-app>
...
<login-config>
<auth-method>FORM</auth-method>
<!--realm-name not required for FORM based authentication -->
<form-login-config>
<form-login-page>/formlogin.html</form-login-page>
<form-error-page>/formerror.html</form-error-page>
</form-login-config>
</login-config>
...
<web-app>

thanks,
ram
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41631
    
  55
In most cases you don't need to fiddle around with the response in your own code. If you set things up properly -like Ramu hints at- and then tell the container where to look for your user information (e.g. for Tomcat that's described here), then you should be all set.

can i get some answers for this question???

As an aside, it would have been polite to put a "please" in this sentence, instead of adding three question marks.
[ June 29, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Tracking in Servlets