I want to inject the Servlet Context to the Validator placed in the Entity. But null is returned...
Example:
@Entity
class Test{
@TestValidator()
int something;
}
TestValidator implements ConstraintValidator{
@Context ServletContext ctx
}
The scenario is that the action is from the facelet. Then the managed bean's action is invoked based on the user's action. I want to pass the ServletContext of that action to the Validator annotated in the Entity class but null is return.. I thought that Servlet Context is application scoped.
Question: Is there a way to access that Servlet Context in the validator?
Thanks!