Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Tracking in Servlets

 
gowrishankar sundararajan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i get some answers for this question???
 
Ramu Pamidimarri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic