Note that there are some explanatory texts on larger screens.

plurals
  1. POWicket - Inter-session communication or Create new Request(Cycle) manually
    primarykey
    data
    text
    <p>I have some wicket panel store in a static Hashmap from different sessions, i want to do some like if some panel notifies the map, then the map notifies all other panel. for example: </p> <pre class="lang-java prettyprint-override"><code>public class PanelMap{ private static Map&lt;Long, List&lt;MyPanel&gt;&gt; map = new HashMap&lt;Long, List&lt;MyPanel&gt;&gt;(); public static void subscribe(Long id, MyPanel panel){ if (!map.containsKey(id)){ map.put(id, new ArrayList&lt;MyPanel&gt;()); } map.get(id).add(panel); } } public static void notify(Long id, String notification){ if (map.containsKey(id)){ List&lt;MyPanel&gt; panels = map.get(id); for(MyPanel panel : panels){ panel.newNotification(notification); } } } } </code></pre> <p>In Panel, newNotification(String notification) i want to send request to server and refresh my panel in browser.</p> <pre class="lang-java prettyprint-override"><code>public void String newNotification(String notification){ // do some business logic depends on notification onMyRequest(); } </code></pre> <p>i've made some search among wicket behavior source files and about i found in <code>AbstractDefaultAjaxBehavior</code> i tried to make my own onRequest method inside my wicket panel as follows</p> <pre class="lang-java prettyprint-override"><code>private void onMyRequest(){ AjaxRequestTarget target = ((WebApplication)getApplication()).newAjaxRequestTarget(getPage()); target.add( _some_wicket_components_ ); RequestCycle.get().scheduleRequestHandlerAfterCurrent(target); } </code></pre> <p>but all i did is some Ajax error in Wicket Ajax Debug about </p> <pre><code> Wicket.Ajax.Call.processComponent: Component with id _containerdiv_ was not found while trying to perform markup update. ERROR: Cannot find element with id: _someComponentIdOnPanel_ </code></pre> <p>(those components are exist)</p> <p>How could i send my own request to server (or how can i get valid AjaxRequestTarget to update my components? )</p> <p><strong>Update:</strong> I need inter-session communication.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload