aspose file tools*
The moose likes JSF and the fly likes Problem with sessionScoped Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem with sessionScoped" Watch "Problem with sessionScoped" New topic
Author

Problem with sessionScoped

mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Hello All i have problem with Session Scoped
i have 2 dialog in the same page
dialog 1 display list of category show by datatable
dialog 2 display detail of category when user click edit on dialog 1.
i can get id and data between 2 dialog but i must refresh page to load data from dialog 1 to dialog 2 it mean
when i click edit category with id #1 dialog 2 display null and i must refresh page and then click on category with id #3 it display id #1
please help me! how can i solve this problem
i use session scoped for jsf managed bean
i try use viewscoped for manage bean but it can not get data between 2 dialog just session scoped or application scoped can do it
please !! help me !! thank you
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
no anyone in there?
Vadym Baranenko
Greenhorn

Joined: Oct 06, 2010
Posts: 18
Try to use ajax support, But seems to me that it is a bad practice to share page between two dialogs. Personally I when need such functionality, using one beal for the list and for the edit/create functionality.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

Patience, grasshopper. We don't get paid to do this.

I can't understand your question. Can you have someone who has good English skills help you make it plainer?


Customer surveys are for companies who didn't pay proper attention to begin with.
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Tim Holloway wrote:Patience, grasshopper. We don't get paid to do this.

I can't understand your question. Can you have someone who has good English skills help you make it plainer?


ok i will describe my problem with image you can see below:






As you can see when i login into admincp and click icon Category
dialog one display, next i continue click on edit icon of Category Name Books
dialog 2 display null




in picture 2, i was refresh page and click on edit icon of category Magazine, dialog two display Category Name is Books

my question is how can i don't refresh page but it also display value such as Books , magazine in dialog 2?
Vadym Baranenko
Greenhorn

Joined: Oct 06, 2010
Posts: 18
So why don't you use one bean for this actions?
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Vadim Baranenko wrote:So why don't you use one bean for this actions?

Hi Vadim i use one bean for this action
i do not want refresh page, but can get value from dialog 1 to dialog 2
Vadym Baranenko
Greenhorn

Joined: Oct 06, 2010
Posts: 18
Oh, I see. I didn't get it. I assuming that small window is a modal panel? than gust try to rerender only part of the page. Use something like that :

<a4j:commandButton type="button" action="#{somsBean.save}" reRender="idThatYouNeed" immediate="true" value="#{messages.button_Save}"/>
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Vadim Baranenko wrote:Oh, I see. I didn't get it. I assuming that small window is a modal panel? than gust try to rerender only part of the page. Use something like that :

<a4j:commandButton type="button" action="#{somsBean.save}" reRender="idThatYouNeed" immediate="true" value="#{messages.button_Save}"/>


Hi Vadim thank you for your support but i use primefaces and reRender attribute is update attribute of primeface, i tried it bot not work, it open dialog and close in 2 second
Vadym Baranenko
Greenhorn

Joined: Oct 06, 2010
Posts: 18
Sorry, but I don't know how it works in primefaces.
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Vadim Baranenko wrote:Sorry, but I don't know how it works in primefaces.


Hi Vadim i will explain my problem again

as you see 2 picture
i have data list with data table show all list of category , it's ok?
and when i click details one of them it will display dialog 2 show details of category such as category id (was hidden) category name (books)
normally i must have 2 page , 1 page is ListofCategory.jsf and second page is CategoryDetails.jsf
1 page will display list with datatable show all list of Category and i click Edit Category with id #1 , category name is Books it will pass id from ListCategory.jsf to CategoryDetails.jsf
url such as http://localhost:8080/ListofCategory.jsf pass to http://localhost:8080/CategoryDetails?id=1

but in case i have 2 form in one page , it mean data table and details of Category in one page and inside two dialog
i can get value from dialog to dialog two but you can see on 2 picture, i click on id #1 it display null i must refresh page and click other id, and it display details Category Name with id = 1
do you understand?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2864
    
  11

So "danh muc san pham" means category, and "Sua" means fix (or edit). You want to be able to click on the icon next to a category and see a dialog pop up with the name of the category, which you can then change and save. Instead, the first time you click on a category icon you see a dialog with an empty category name, and the second category icon you click creates a dialog with the name of the first category. Is that the problem you're having?
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Greg Charles wrote:So "danh muc san pham" means category, and "Sua" means fix (or edit). You want to be able to click on the icon next to a category and see a dialog pop up with the name of the category, which you can then change and save. Instead, the first time you click on a category icon you see a dialog with an empty category name, and the second category icon you click creates a dialog with the name of the first category. Is that the problem you're having?

it also similar your describe, firs time i click Edit Books to edit name of Category books, it return empty , if i want display Name is Books in dialog pop-up i must refresh page (f5) because session scoped pass id from page A to page B and page B get this id and display details of Category for id from page A pass to B, but i want handle on 1 page
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2864
    
  11

OK, that makes some sense. However, I don't think it's really necessary hit the server until the user saves the change to the category name. I'd just use client-side code like jQuery or just plain JavaScript to fill in the dialog. There must be a function to pop up the dialog or make it visible anyway. Why not just pass a parameter into that?

If you're determined to hit the server and update the dialog with a session variable, then Ajax with a reRender is the right thing to do. I haven't worked with PrimeFaces either, but I know I sometimes have a terrible time getting my re-rendered sections to actually re-render. There must be a trouble-shooting guide somewhere, but some of the things I've found is the section must be in an Ajax compatible form like <h:form> or <a4j:form> and there are some limits on what kind of sections can be re-rendered. For example <div> probably wouldn't work, but say, <a4jutputPanel> would. Actually, the last time I used <a4jutputPanel>, I had to add the attribute ajaxRendered="true" before it worked. I'm still not sure why.

Good luck! Chúc may mắn! And if you don't mind the suggestion, we really encourage using real names on JavaRanch.
mye kency
Greenhorn

Joined: May 09, 2010
Posts: 14
Greg Charles wrote:OK, that makes some sense. However, I don't think it's really necessary hit the server until the user saves the change to the category name. I'd just use client-side code like jQuery or just plain JavaScript to fill in the dialog. There must be a function to pop up the dialog or make it visible anyway. Why not just pass a parameter into that?

If you're determined to hit the server and update the dialog with a session variable, then Ajax with a reRender is the right thing to do. I haven't worked with PrimeFaces either, but I know I sometimes have a terrible time getting my re-rendered sections to actually re-render. There must be a trouble-shooting guide somewhere, but some of the things I've found is the section must be in an Ajax compatible form like <h:form> or <a4j:form> and there are some limits on what kind of sections can be re-rendered. For example <div> probably wouldn't work, but say, <a4jutputPanel> would. Actually, the last time I used <a4jutputPanel>, I had to add the attribute ajaxRendered="true" before it worked. I'm still not sure why.

Good luck! Chúc may mắn! And if you don't mind the suggestion, we really encourage using real names on JavaRanch.


Thank you for your support i was solve my problem with http://www.primefaces.org/showcase/ui/datatableRowSelectionByColumn.jsf many thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with sessionScoped