2

please help me to solve this problem. After login user will refer to the Search home page, which in a WEB-INF folder. I have no web.xml file and here is my code: please help me to correct it.

$("#login").click(function(){
var hashPassword = hex_md5($("#password").val());
var requestData = {
        username: $('#username').val(),
        password: hashPassword,
        action: "login",
};
$.ajax({
    type : "POST",
   url : "/Library/dispatcher",

    data : requestData,
 }).done(
         function(responseData){
             if(responseData.error){
                 console.log(responseData.error);
                 $('#unsuccess').show();
             }
             else{
                 if(responseData.success){
                    // window.location.href = "/Library/WEB-INF/search.html";
                       window.location.href = "/WEB-INF/search.html"; 
                 }
                 else{
                     $('#unsuccess').show();
                 }
             }
        });


});
nhgrif
  • 61,578
  • 25
  • 134
  • 173
Mary
  • 59
  • 3
  • 8

2 Answers2

3

WEB-INF is the only directory that is not accessible from the outside, because it contains the code and configuration of your app, that should not be available.

Put your html file anywhere else.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
2

Static resources are usually outside the WEB-INF. Everything inside WEB-INF must not directly browsed by URL. Move your search.html on the same level as your WEB-INF folder.

yourproject-root
  - WEB-INF
     -- <inside web-inf>
  - Search.html
Marco Acierno
  • 14,682
  • 8
  • 43
  • 53
swinkler
  • 1,703
  • 10
  • 20
  • hope you don't mind if I changed a bit your tree, it looks more easy to understand now – Marco Acierno May 04 '15 at 20:54
  • Thanks. Looks better now! – swinkler May 04 '15 at 20:55
  • Thanks for yor reply. I purposely inserted it in web-xml, becaouse I want a user to prevent direct access to this page. User must at first access to Login page and through login go to the search.html page. – Mary May 05 '15 at 07:33
  • Therefor you need some additional configuration/implementation. web.xml provides a login configuration with form-based authentication - here everything is described http://docs.oracle.com/javaee/5/tutorial/doc/bncbx.html – swinkler May 05 '15 at 07:39