使用POST隐藏URL中的数据

时间:2014-06-07 17:49:16

标签: java jsp url post controller

我正在尝试使用具有Login功能的系统...我正在使用MVC ... Java和JSP页面..

@RequestMapping(value = "/register", method = RequestMethod.POST)
public @ResponseBody
void register(String fN,String lN,String email, String password, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
    System.out.println("Entered register function yarab !");
   System.out.println("First Name: "+fN);
   System.out.println("Last Name: "+lN);
   System.out.println("email: "+email);
   System.out.println("password: "+password);

   Enduser user= new Enduser(fN,lN,email,password);
   rep.addUser(user);
   System.out.println("User Successfully added !");


}

这是我在有人注册时使用的控制器功能......

    $(function() {
   $('.register').click(function()
           {


               var fN=document.getElementById('fN').value;
               var lN=document.getElementById('lN').value;
               var email=document.getElementById('emaill').value;
               var password=document.getElementById('pass').value;


              $.ajax({
                    url: '/quconnectsu/register',
                   type:'POST',
                    data: { fN:fN, lN:lN, email:email, password:password},
                    success: function() {

                    }
                });
            });
            });

和JSP中的代码在输入注册按钮时将数据发送到控制器! ......

我需要隐藏网址中的信息..

    ( http://localhost:8080/test/homepage.jsp?fN=Maha&lN=Mohasseb&emaill=&pass= ) !.... I dunno what's the problem since i'm using POST !! .. why does the data appears !! ... 

请帮助我!

0 个答案:

没有答案