i have a servlet named as follow : <servlet> <servlet-name>data</servlet-name> <servlet-class>DatabaseServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>data</servlet-name> <url-pattern>/data</url-pattern> </servlet-mapping> I access my servlet by writing : http://localhost/base/data and i get my login.html because it is with security but when i write http://localhost/base/servlet/data i directly access my servlet. I want to know what must i do so that i also get the login.html before accessing to the servlet . Thanks
if i remember right, the security constraint works only if you use a mapped path, and not the relative url of the servlet. so, you need to desable a user's possibility to enter your servlets via .../servlet/... path. (you can map /servlet to a page wchich will say that direct entry is disabled). all this in case i remember this topic right
Joined: Feb 09, 2002
Asher thank you. Is it possible to do a mapping to'http://localhost/base/servlet/data' . How can i do a mapping so that the user gets the login.html ?
I think that you may use a variable in your session. Once you are logged, you set the variable to true (if the login is correct, of course). Every time that you access a ressource, you must first check if your variable is set to true, if not you redirect to login.html, else you continue your business logic. I think there is a way by there. Good luck Engin
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.