There is such a block in JSP :

 <div class="language"> <span class="lang en" data-lang="en_US">Eng</span> <span> | </span> <span class="lang ru" data-lang="ru_RU">Рус</span> <form method="POST" action=""> <input type="hidden" id="lang" name="lang" value=""> </form> </div> 

There is such a JS code:

 if (window.location.pathname === '/') { $('div.language form').attr('action', window.location.pathname); } else { $('div.language form').attr('action',window.location.pathname.replace('/','')); } $('div.language span.lang').click(function (e) { e.preventDefault(); $('input#lang').val($(this).attr('data-lang')); $('div.language form').trigger("submit"); }); 

When the page is loaded with JS action automatically written on the same page. The problem is that after submitting the form, the lang parameter.

I extract the parameters like this: request.getAttribute("lang") . I do it in the filter. Comes null .

What could be the problem?

I tried already and prescribe action - it does not help.

    1 answer 1

    To get GET / POST parameters, use

     request.getParameter("lang") 
    • how is that. how it could be stupid. Thank you very much! - Tsyklop