-
1. Re: Rerender a t:dataTable using a4j - basic steps
sergeysmirnov Apr 17, 2007 10:56 AM (in response to graflaszlo)"graflaszlo" wrote:
I use an AJAX request to use a servlet, wich adds a new item to a
manages bean's private list.
Clarify, please. -
2. Re: Rerender a t:dataTable using a4j - basic steps
graflaszlo Apr 17, 2007 1:36 PM (in response to graflaszlo)Hi Sergei,
1. In my JSP file I have an inputText field, I enter a name into it, then I
click on AddUgyfelCL or DelUgyfelCL commandLink to add or delete the
name from a HashSet.<t:inputText id="InputAdatlapElozetesUgyfelNeve" value="" required="#{adatlapelozetesbean.isFelvetel}" styleClass="form-text"/> <a4j:commandLink id="AddUgyfelCL" onclick="AddUgyfel2AdatlapElozetes()" reRender="UgyfelekTablaja"> <t:graphicImage value="../img/add_small.gif" border="0" alt="Hozzáadás" /> </a4j:commandLink> <a4j:commandLink id="DelUgyfelCL" onclick="DelUgyfel2AdatlapElozetes()" reRender="UgyfelekTablaja"> <t:graphicImage value="../img/del_small.gif" border="0" alt="Törlés" /> </a4j:commandLink>
2. The following JavaScript functions are invoked by the commandLinks:function AddUgyfel2AdatlapElozetes() { var ajax = new AJAXInteraction("/adatlapelozetes?muvelet=AddUgyfel&ugyfel=1", AddUgyfel2AdatlapElozetesCallBack, new Array()); ajax.doGet(); } function AddUgyfel2AdatlapElozetesCallBack() { //alert("AddUgyfel2AdatlapElozetesCallBack()"); } function DelUgyfel2AdatlapElozetes() { var ajax = new AJAXInteraction("/adatlapelozetes?muvelet=DelUgyfel&ugyfel=1", DelUgyfel2AdatlapElozetesCallBack, new Array()); ajax.doGet(); } function DelUgyfel2AdatlapElozetesCallBack() { //alert("DelUgyfel2AdatlapElozetesCallBack()"); }
3. The/adatlapelozetes
mapped servlet, locates the
managed bean using FacesContext and adds the entered name to the
managed bean's member, wich is a HashSet.
4. Finally the JSP file displays the the content of this HashSet using
a t:dataTable. This dataTable I want to rerendered after each
AddUgyfel and DelUgyfel without to reload the page. -
3. Re: Rerender a t:dataTable using a4j - basic steps
sergeysmirnov Apr 17, 2007 1:48 PM (in response to graflaszlo)I see the 3rd party code is involved onclick. What this code comes from? I mean what the library you use?
Also, it is not clean for me why you add additional ajax behavior to ajax link (ie. you will have double Ajax request at once)
What is a special reason to use 3rd party library here? -
4. Re: Rerender a t:dataTable using a4j - basic steps
graflaszlo Apr 17, 2007 1:59 PM (in response to graflaszlo)There is no 3rd party lib. The onclick attributes contain JavaScript functions contained in the JSP page. These functions are Ajax
interactions and access Java servlets. -
5. Re: Rerender a t:dataTable using a4j - basic steps
sergeysmirnov Apr 17, 2007 2:03 PM (in response to graflaszlo)var ajax = new AJAXInteraction("/adatlapelozetes?muvelet=AddUgyfel&ugyfel=1", AddUgyfel2AdatlapElozetesCallBack, new Array());
ajax.doGet();
Do not say this is embedded functionality Netscape added to javascript dozen years ago. -
6. Re: Rerender a t:dataTable using a4j - basic steps
graflaszlo Apr 17, 2007 2:09 PM (in response to graflaszlo)OK. I did know it.
Can you help me to rerender that t:dataTable after I add a a new item to
that HashSet in the background? -
7. Re: Rerender a t:dataTable using a4j - basic steps
sergeysmirnov Apr 17, 2007 2:26 PM (in response to graflaszlo)If you do not know what you are doing how others can help you.
Do you have anybody around you who can explain how the stuff you use work?