Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
945 views
in Technique[技术] by (71.8m points)

glassfish - JSF/Mojarra "flash scope" problems

I've got an app running on Mojarra 2.1.1 / Glassfish 3.1 which has now grown to 150,000+ lines of code. The app uses ajax extensively with ViewScoped managed beans and the page-redirect-get pattern (i.e. faces-redirect=true).

One thing that is continually annoying me is the apparent lack of ease of passing parameters from page to page, and bean to bean (every page has it's own backing bean).

I've not been able to get the flash working. I typically need to access the data I've written to the flash in the preRenderView event listener of the next page. This doesn't work reliably, particularly after an application redeployment.

I've read up on CDI and have spent a few days trying to migrate from JSF managed beans to CDI beans, but can't get it to work. There seems to be a lot of compatibility issues between Seam 3 and Glassfish 3.1. I upgraded Weld to 1.1.1 but this doesn't help. From my perspective it just doesn't work at the moment. When I say doesn't work, for example I have a page trying to h:inputText into a String in the backing bean and this doesn't work, really simple stuff.

Because of the CDI problems I'm having I can't use seam-faces @RenderScoped which in a very simple test application (even on g/f 3.1) does just what I want, but not in the complex main application.

The only reliable mechanism I can find to use at present is URL parameters which are a security nightmare. Even though every effort is made to ensure that access to data is properly authenticated there's always the change of missing something, and seeing ...xhtml?id=51031 or whatever in the browser is too much for some people to resist trying other ids. I've written an obfuscation converter to avoid clear text and don't use meaningful names for the name/value pairs, but this doesn't get to the root of the problem.

I just wondered if I was missing something here, has everyone else got a working solution to this problem, even on glassfish? Am I worrying too much and should stick with URL params? Any other suggestions?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I saw the same. At the time I tried it Seam3 was very buggy and it's very hard to get it deployed to different servers. I switched to MyFaces CODI which worked without any problems from the very beginning. In your case you should have a look at @ViewAccessScoped. You can get rid of all those annoying workarounds.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...