Storing inputText values when "jumping" from one controller to another
I have the following mask/view:
After entering the name and description, I can add a list of existing attributes by clicking on "Add existing" button. This opens another mask/view, where I can select from a list of existing attibutes. This (new) mask/view has it's own controller and model too.
When I'm finished with the selection, I have another button that bring me back to this mask.
The problem is that when I come back the name and description fields are empty. This happens because when I click the "Add existing button" the controller/model of this mask is not called and the values are not stored.
开发者_运维问答How can avoid this and have the values stored?
Thank you for any help Francesco
This only works if the new view is inside the same view. E.g. when it's an overlay dialog which is presented by a hidden <div>
and not a plain window.open()
popup window. This way the beans will have access to each other and you will be able to execute ajax updates instead of submitting/refreshing the entire page.
This is pretty complex to homegrow if you're not that familiar with HTML/CSS/JS. I suggest to look at a component library which offers such a component like RichFaces' <rich:popupPanel>
and PrimeFaces' <p:dialog>
.
You can store data in session or conversation bean. Session bean approach have huge drawback when user works in multiple tabs/windows - he uses only one session bean, so he overwrites what he did in other windows.
Conversation scoped bean solves this. But conversation scope was not in javaEE 5, its in CDI (part of EE6).
精彩评论