Need Help with JSF and Javascript / AJAX


Web tier: servlets, JSP, Web frameworks: Need Help with JSF and Javascript / AJAX

  1. Need Help with JSF and Javascript / AJAX (1 messages)

    I need help with following scenario: I have a XML file wherein the parameters of different pop-up windows are stored(height,width,left,top). Now I open a pop-up window from my JSF by calling a Javascript function.When I call that JS function, values are forwarded from XML file to the Javascript. There will be multiple pop-ups on a single page. Now the User can change the position and size of the pop-ups and clicks a "Save settings" button on the Pop-up.When the user clicks, the new coordinates will be saved into the XMl so that whenever he opend that pop-up it opens in the new location with new coordinates. Can you guys please help me out in this. How should I proceed ? 1. Should I use AJAX for this such that AJAX reads the coordinates from XML files and updates it ? 2. Or JSF reads the values from XML file using a Backing Bean and then forwards these values to Javascript. Similarily when I need to write values to XML, Javascript forwards these values to JSf and JSF calls the Bean which updates in XML. Please help me out in this. Abhilash

    Threaded Messages (1)

  2. Use Custom Tag[ Go to top ]

    I recommend your second approach. When a page is being rendered, you already know the popup pages that could be opened from it. Why bother with Ajax in such case?? I would recommend the following design: 1. Write a PopupConfig backing bean (application context) that reads the XMLs on demand. You could do some caching as well. 2. Write a Custom Tag to read the data from PopupConfig and render the values as a JSON object in the page. JSON makes your scripting job easier. For the reverse path,viz. Save settings, you could use AJAX. But before doing so, consider the alternative of storing it locally and then piggybacking it with the next submission.