• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Programmatic JSF, perfect, but what about removing things

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm developing a kind of framework able to render on MyFaces (Jsf 1.2)/IceFaces(Jsf 1.2)/Swing/WinForms/Asp.Net/WPF, using the SAME base logic for everything and a kind of "rendering" face for every environment.
(I'll will show it to the world shortly, right the time to solve a couple of things, like an engine to understand css for Swing and WinForms nearly ready, and the following problem:)
Currently, after some struggling everything works perfectly, all is done completely programmatically, datagrids, dialogs, validation, etc... in all the environment. Only one thing keep resisting the assimilation: i can't remove programmatically an UIComponent (programmatically added of course) from the component tree in MyFaces. As far as i understood this i caused by the restoration of the ViewState after the postback. The FacesServlet is not able to load the ViewState informations inside an UIComponent that has been destroyed.. If i simply do a refresh, everthing back again to work like a charm. I tried to KILL the ViewState hidden field through javascript but then i have various exception caused by a viewState not in the right format (strange is'n t it :P )

This is the exception i get after the following actions
1) I create the part inside the Form programmatically
2) I click everywhere to do stuffs like CRUD operations, searches and so on (but nothing is removed)
3) I click on the button to remove stuffs, than as before a postback is called
4) Inside the event handler of the button an HtmlPanelGroup (or any other kind of control) is removed from the parent (pareng.getChildren().remove(objToRemove))
4a) Then the rendering is made
4b) AND THE DIRTY object i removed is still there staring at me.....

If at this point i do a refresh (through the browser) everything goes perfectly, the state is lost and all is ok

Instead if i do another postback (thus maintaining the previous state) i get the cute exception below:



May be someone is able to give me an idea on how to manage such a nasty situtation

Enrico
 
Enrico Derossi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another thing i tried was to keep the same component tree during the various requests. That means i have a binding on the form, with a getter method that returns always the same HtmlForm without rebuilding everything all the times, while the setter does nothing.
Nothing changes...
I tried even to simply set the "rendered" attribute o true on the deleted controls.. (without removing them) but they are rendered with the same pattern described before (first rendered, second click not rendered with exception, third click all works perfectly)
I don't ant to inherit from the implementation that i'm using intercepting the moment in wich the viewstate is applyed. AND i dont'know how to remove these controls from the gui at the first postback...seems like it's impossible...
Tomorrow i'll try to use the valuebinding to set the rendered attriubute on the various objects (so with a runtime created el-expression)
Hope to find a solution asap... let me prefer jsf instead of asp.net :P
 
Enrico Derossi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOLVED!!
For some strange reason i thought to bind all the components with a valueexpression and magically everything works!!!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Is there a way you can put the value that a user selected in a listbox to a map ?
If so, can you provide a snippet of jsf(/icefaces) code to do so ?

Regards,
EDH
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic