FYI: Solved in wicket 1.3-snapshot

I tried this with the new 1.3 snapshot and the info messages are now 
shown in the feedbackPanel, without using(abusing) Session.
And, attempting to create the feedbackPanel during onAttach results in 
the following sensible message:

WicketMessage: Cannot modify component hierarchy during attach phase

cheers,

Ivana

Ivana Cace wrote:
> I've found a bug in wicket with the use of FeedbackPanel for messages on 
> events during page construction.
> For example when a page is constructed using information from the dao to 
> fill a dropdownChoice and some non-fatal event occurs during the trip to 
> the dao.
>
> The bug is this:
> - If a feedbackPanel is created in the Page constructor, info messages 
> added during onAttach do not reach it. The only way to get these 
> messages on the feedbackPanel is to explicitely add them through the 
> Session:
> getSession().info("message"); 
> And then the page has to be refreshed to view the messages - no 
> surprise, this is in the API.
>
> - And if the feedbackPanel is created during onAttach, the error below 
> occurs. I sometimes use onAttach to call a method to initialize 
> components because that way i have a page and therefore a full path 
> during component construction, enabling me to get to use 
> internationalization.
>
> Here is the simplest code producing the bug:
>
> import wicket.markup.html.WebPage;
> import wicket.markup.html.panel.FeedbackPanel;
>
> public class TestPage extends WebPage {
>    
>     public TestPage() {
>         add(new FeedbackPanel("feedback"));
>     }
>    
>     @Override
>     protected void onAttach() {
>         super.onAttach();
>         // if the feedbackPanel is created and/or added here instead of 
> in the constructor,
>         // an error occurs       
>         //add(new FeedbackPanel("feedback"));       
>         info("Hello user, a non-fatal exception occured during page 
> construction");
>     }
> }
>
> I have tried what happens if a form and other components are added to 
> the page but its basically the same.
> If the feedbackPanel was instantiated and added to the form during the 
> overridden onAttach methos, the same error appeared.
>
>
> Is this really a bug?
>
>
> cheers,
> Ivana
>
>
> ************ BEGIN ERROR **************
>
> WicketMessage: Exception in rendering component: [MarkupContainer 
> [Component id = feedbackul, page = testPackage.TestPage, path = 
> 51:feedback:feedbackul.FeedbackPanel$2, isVisible = true, isVersioned = 
> false]]
>
> Root cause:
>
> java.lang.NullPointerException
> at wicket.markup.html.list.ListView.renderItem(ListView.java:676)
> at wicket.markup.html.list.ListView.onRender(ListView.java:637)
> at wicket.Component.render(Component.java:1526)
> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1334)
> at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:982)
> at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:917)
> at wicket.Component.renderComponent(Component.java:1712)
> .
> .
> .
>
> Page
>
>       [Page class = testPackage.TestPage, id = 51]:
>       #     Path     Size     Type     Model Object
>       1        <auto>_header        481 bytes        
> wicket.markup.html.internal.HtmlHeaderContainer          
>       2        _<body>        425 bytes        
> wicket.markup.html.internal.HtmlBodyContainer          
>       3        feedback        1.5K        
> wicket.markup.html.panel.FeedbackPanel          
>       4        feedback:feedbackul        2.7K        
> wicket.markup.html.WebMarkupContainer          
>       5        feedback:feedbackul:messages        2.7K        
> wicket.markup.html.list.ListView        [[FeedbackMessage message = 
> &quot;Hello user, a non-fatal exception occured during page 
> construction&quot;, reporter = 51, level = INFO], [FeedbackMessage 
> message = &quot;Hello user, a non-fatal exception occured during page 
> construction&quot;, reporter = null, level = INFO], [FeedbackMessage 
> message = &quot;Hello user, a non-fatal exception occured during page 
> construction&quot;, reporter = null, level = INFO], [FeedbackMessage 
> message = &quot;Hello user, a non-fatal exception occured during page 
> construction&quot;, reporter = null, level = INFO], [FeedbackMessage 
> message = &quot;Hello user, a non-fatal exception occured during page 
> construction&quot;, reporter = null, level = INFO]]  
>
>
> ************ END ERROR **************
>
>
>
>
>
>
>
>   


-- 
Ivana Cace
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to