1.

What Is The Purpose Of @before Annotation?

Answer»

The @Before ANNOTATION marks a action METHOD that needs to be called before the main action method and the result was executed. Return value is ignored.

public class Employee extends ActionSupport{

@Before

public void isAuthorized() throws AuthenticationException {

// authorize request, throw exception if FAILED

}

public STRING execute() {

// perform secure action

return SUCCESS;

}

}

The @Before annotation marks a action method that needs to be called before the main action method and the result was executed. Return value is ignored.

public class Employee extends ActionSupport{

@Before

public void isAuthorized() throws AuthenticationException {

// authorize request, throw exception if failed

}

public String execute() {

// perform secure action

return SUCCESS;

}

}



Discussion

No Comment Found