1

I am trying to make a login page in java J2EE. Actually, I succed in making a jsp page, called login.jsp, an ActionSupport class called LoginAction. In my jsp I've created some text area, password area and submit, allowing me to send informations entered in those areas and get them in my action. This works fine. My problem is that I don't succed in using another function than execute. In my action I have several other functions and I can't call them in my ajax function :

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
      $(function() {
        $('#submit').click(function() {
            var login=$("#login").val();
            var password=$("#password").val();
          $.ajax({
            type: 'POST',
            url: 'login.action/test', // -> here it fails.............
            data: { login: login, password: password },
            success: function() {
              alert('YEAH'); },
            error: function() {
              alert('Request failed'); }
          });    
        });  
      });
</script>

What should I put in url area, if I want for example to call test function in my LoginAction class? (I've done a test.jsp page, it doesn't change anything...)

3 Answers3

0

OK I found the answer. So here it is : It's called "dynamic method invocation" (with wildcard method), and you can find the doc here : http://struts.apache.org/release/2.0.x/docs/action-configuration.html#ActionConfiguration-WildcardMethod

0

It is very important to use last struts2 release to avoid critical security bugs while using wildcard method - see https://struts.apache.org/release/2.3.x/docs/s2-015.html for details.

Yury
  • 29
  • 1
-1

use "function nametest()" instead of "function()"

pinkyjain
  • 1
  • 1