Hi!

i'm a new user of jsf.
I'm developing a web application in jsf 2.0 . There is a page in my application for which i have given session scope.
In this page i retrieve values in a datatable from mysql database according to the chosen combo box values.
I navigate from this page to some other pages in my application and when i come back to this same page again the previous values displayed already from the database remains as such since the bean scope is session.
I have to reset the values of datatable and combobox.
Any help appreciated.
Thanks in advance.

Regards,
Indu

Recommended Answers

All 6 Replies

I don't know anything about jsf, but can you make it so it won't be session scope?
If you had already thought of that, then sorry, but that's all I can think of.

Thanks for your response..
I used only request bean in the beginning but later there is a need for me to make it as a session bean.
can you suggest any solution to reset the session when i re-enter the page?

Regards,
Indu

I think that when the page loads, you can remove the object from the session, or take the object and create a new instance.

Thanks for your idea..
Can you give me any sample code for that?
I tried with

FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("MyBean");

but it didnt work...

Regards,
Indu

Look at the API of the methods you are using. If getSessionMap returns a Map object, then try to print the keys that it has.

Also when you call that code. You need to post your code, so we can see what exactly are doing.

Hi!

Thanks a lot for your help.I have solved this issue by getting those session variables and clearing it.

Regards,
Indu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.