Announcement Announcement Module
Collapse
No announcement yet.
PropertyEditor - The way to access an attribute of request/session? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • PropertyEditor - The way to access an attribute of request/session?

    Hello!

    In my application I'm using PropertyEditors, and they are working perfectly, but I have one situation that I can't find the way to solve it using them. The context:

    Currently, I'm using as modelAttribute an Entity of my model, and with PropertyEditors I'm converting the values to the corresponding attributes of it. But, one of the attributes of my entity is referenced with a composite key (two fields).

    For setting this attribute, a form:select is used, but I need two elements to retrieve it in the corresponding PropertyEditor. From the form:select I'm returning one, but I don't know the way to access the other one inside the PropertyEditor.

    It is possible to access the HttpServletRequest or the Session from the PropertyEditor?

    My current implementation of the WebBindingInitializer is this:

    Code:
    public class LBDPortalBindingInitializer implements WebBindingInitializer 
    {
       ...
    
           @InitBinder
    	public void initBinder(WebDataBinder binder, WebRequest request)
    	{
    		binder.registerCustomEditor(Gender.class, new GenderPropertyEditor(researcherService) );
                    ...
           }
       ...
    }
    Exist any way to achieve this?


    Thanks
Working...
X