The system I have integrated myfaces in has a development mode and tried to make myfaces comply to that idea... :) The solution I did was q&d, so you can always make a solution that works for you..

Mvgr,
Martin

Eurig Jones wrote:
I see what you're doing here. The problem is is that you dont want to remove the values after every single call to your myFaces servlet, just the very first one after a code change.

Also, I didn't realise MyFaces had a development mode. If so, what does it do exactly?

Thanks,
Eurig

Martin van den Bemt wrote:

In my case I use my own myfaces servlet, check if the site is in development mode, and just remove the jsf specific values from the session.
Something like this :

HttpSession session = ((HttpServletRequest) request).getSession();
                if (session != null) {
                    Enumeration en = session.getAttributeNames();
                    while (en.hasMoreElements()) {
                        String name = (String) en.nextElement();
                        if (name.indexOf(target) != -1) {
                            // remove this key...
System.out.println("NOT REMOVING SESSION ATTRIBUTE : " + name);
                            session.removeAttribute(name);
                            // and stop the while loop.
                            break;
                        }

                    }
                }

target = the jsf session key (just print out everything in the session to see how the key is contrsucted)

Since this a pretty abnormal use case, maybe this can be done in some prerendering phase in myfaces, but I really don't have a clue how to handle that, but you want this to happen before the session is read by myfaces and in a place where you can get a hold of the HttpSession.

Mvgr,
Martin

Eurig Jones wrote:

How do i clear the session?? Can you do this everytime you reload the app or something? I'm not sure how to remove myfaces specific session attributes either.

Martin van den Bemt wrote:

Just clear the session or remove myfaces specific session attributes (that's what I do to make sure everything is reparsed). I thought the session attribute for the page is named after the jsp filename on the physical filesystem.

Mvgr.
Martin

Eurig Jones wrote:

Hi,

I've been having a lot of trouble this week developing my JSF application. I've found it very time consuming to update/test my code due to sessions (i guess its a session related problem anyway).

Everytime I do an update (to a JSF tag for example), I find that I have to reload the application, and restart the browser to get it to run correctly. Its ok when I edit some backend code, but its extremely annoying having to reload and close browser all the time when I update a tag value. The session seems to keep the bean values after you reload.

How do you lot get around this problem?

I'm using MyEclipse with the latest MyFaces release.

Regards,
Eurig





Reply via email to