forum

Home / DeveloperSection / Forums / How to retrieve session object in jsf view

How to retrieve session object in jsf view

Manoj Bhatt215201-Nov-2014

I have a RequestController(@ManagedBean and @ViewScoped) it is view scoped because we are using some ajax calls.

I have a dataTable with result and each result with a button

<p:commandButtonaction="#{requestController.requestDetail()}"icon="ui-icon-search"title="Detalhes">
     <f:setPropertyActionListenertarget="#{requestController.backing.selectedRequestVO}"value="#{order}"/>
</p:commandButton>

This method is receiving the selected object of my dataTable and is set on the session, it is working, the problem is that I don't know how to get this session object from my view.

public void requestDetail() throws IOException { 
        FacesContext context = FacesContext.getCurrentInstance();
    context.getExternalContext().getSessionMap().put("requestDetail",backing.selectedRequestVO);context.getExternalContext().redirect(context.getExternalContext().getRequestContextPath() + "/views/request/detail.html");
    }


I need to access it from my view because this object has the request details.


Updated on 01-Nov-2014

Can you answer this question?


Answer

1 Answers

Liked By