You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Pon <ja...@gmail.com> on 2012/12/28 03:05:35 UTC

@ViewAccessScoped datatable selected row value not available for first time

Hello

In my managed bean I have @ViewAccessScoped, I have noticed that when user
selects a row from a datatable for the first time, the selected row is not
available in managed bean, however for subsequent selections, selected row
value is available in managed bean. 

If I use session scope, then for the first time itself I am able to get the
selected row value.

What could be the reason for this?

Any help is highly appreciable.

Thanks



--
View this message in context: http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Pon <ja...@gmail.com>.
I have resolved this issue, this has nothing to do with @ViewAccessScoped,
but rather silly cookies issue.

When list.jsf gets loaded for the first time, cookies was not set. So when
user selects a row cookies gets set and thus for subsequent selections user
could get selected row value.

To resolve this issue, I have created a index.jsp page and redirect to
list.jsf, thus cookies get set before user selects a row using radio button.

Thanks



--
View this message in context: http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980p113987.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Gerhard Petracek <ge...@gmail.com>.
hi jacob,

you can ask the primefaces developers, if they know this specific issue
already (they need to support it for jsf 2.2+, std. cdi conversations,...
as well).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/12/28 Pon <ja...@gmail.com>

> Any thing particular I could do to resolve this issue? Any work arounds
> etc?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980p113984.html
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Pon <ja...@gmail.com>.
Any thing particular I could do to resolve this issue? Any work arounds etc?

Thanks



--
View this message in context: http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980p113984.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Gerhard Petracek <ge...@gmail.com>.
hi jacob,

we heard about similar issues in combination with primefaces.
in those cases some parts of primefaces don't propagate parameters (like
the window-id).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/12/28 Pon <ja...@gmail.com>

> Unfortunately I do not have a link to a demo, I have pasted below the code
> I am using. If any other details are required, kindly let me know.
> Appreciated. ManagedBean <nabble_embed> @Named("emp") @ViewAccessScoped
> public class EmployeeManagedBean implements Serializable { private Employee
> selectedRequest = new Employee(); @PostConstruct public void init() {
> initTable(); } private void initTable() { lazyModel = new
> LazyEmployeeDataModel(requestList, requestService); } public
> LazyDataModel<Employee> getLazyModel() { return lazyModel; }
> </nabble_embed> and onRowSelect Method <nabble_embed> public void
> onRowSelect(SelectEvent event) { try { setSelectedRequest((Employee)
> event.getObject()); System.out.println("row " + getSelectedRequest());
> </nabble_embed> JSF Code <nabble_embed> <p:dataTable id="dataTable"
> var="req" lazy="true" value="#{emp.lazyModel}" rowKey="#{req.empNo}"
> paginator="true" rows="10" selection="#{emp.selectedRequest}"> <p:ajax
> event="rowSelectRadio" listener="#{emp.onRowSelect}" /> <p:column
> selectionMode="single" style="" /> </nabble_embed>
> ------------------------------
> View this message in context: Re: @ViewAccessScoped datatable selected
> row value not available for first time<http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980p113982.html>
>
> Sent from the My Faces - Dev mailing list archive<http://myfaces.10567.n7.nabble.com/My-Faces-Dev-f3.html>at Nabble.com.
>

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Pon <ja...@gmail.com>.
Unfortunately I do not have a link to a demo, I have pasted below the code I
am using. If any other details are required, kindly let me know.
Appreciated.ManagedBean @Named("emp")@ViewAccessScopedpublic class
EmployeeManagedBean implements Serializable { private Employee
selectedRequest = new Employee(); @PostConstruct   public void init() {     
initTable();   }    private void initTable() {      lazyModel = new
LazyEmployeeDataModel(requestList, requestService);   }    public
LazyDataModel getLazyModel() {      return lazyModel;    }and onRowSelect
Methodpublic void onRowSelect(SelectEvent event) {      try {        
setSelectedRequest((Employee) event.getObject());        
System.out.println("row "               + getSelectedRequest());  JSF Code                                  



--
View this message in context: http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980p113982.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.

Re: @ViewAccessScoped datatable selected row value not available for first time

Posted by Gerhard Petracek <ge...@gmail.com>.
hi jacob,

please provide more details (and/or a link to a demo which illustrates the
issue).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/12/28 Pon <ja...@gmail.com>

> Hello
>
> In my managed bean I have @ViewAccessScoped, I have noticed that when user
> selects a row from a datatable for the first time, the selected row is not
> available in managed bean, however for subsequent selections, selected row
> value is available in managed bean.
>
> If I use session scope, then for the first time itself I am able to get the
> selected row value.
>
> What could be the reason for this?
>
> Any help is highly appreciable.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://myfaces.10567.n7.nabble.com/ViewAccessScoped-datatable-selected-row-value-not-available-for-first-time-tp113980.html
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>