I got problem reloading a page.

JSP code look like this:

……
<h:form id=”testForm”>
         <tr:commandButton actionListener="#{sampleBean.testActionListener}"
/>

……


<%
    String tempfile=””;
%>
<aa:zoneJSF id="testIncludeZone ">
<%
    tempfile = (String) request.getAttribute("fileName");
%>
    <jsp:include page="<%= tempfile %>" />
</aa:zoneJSF>

        <script language="javascript" type="text/javascript">
ajaxAnywhere.formName = " testForm "
ajaxAnywhere.substituteFormSubmitFunction()
ajaxAnywhere.getZonesToReload = function(url, submitButton) {
  return testIncludeZone
}
ajaxAnywhere.bindById();
ajaxAnywhere.substituteFormSubmitFunction()
ajaxAnywhere.substituteSubmitButtons()
    </script>

</h:form>
…..
…..
</f:view>
In this case I have 3 difference pages( let's called it a.jsp,b.jsp and
c.jsp) that can be included into "testIncludeZone" zoneJSF dynamically.
The manage scope for "sampleBean"  is session.

What I am trying to do is, everytime the button is clicked, I would like to
refresh the “testIncludeZone” zoneJSF and reload a difference page. 
In the action listener is used to set the request attribute called
“filename” and the value is the path to a file that will be included into
this page and I did make check to make sure that the value for this
attribute won't be the same as the current file is display in the page.
the code in action listener
.....
private String currentFilename = "a.jsp";

public void commandLink_action(ActionEvent event) {
   String tmp = "";
   if (currentFilename.equals("a.jsp")){
       tmp = "b.jsp";
   } else   if (currentFilename.equals("b.jsp")){
       tmp = "c.jsp";
   } else   if (currentFilename.equals("c.jsp")){
       tmp = "a.jsp";
   }
   HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
  request.setAttribute("filename",tmp);
}

....................

But what the outcome is At first it will load a.jsp but when I click the
button, the new page is never get refresh. It always display a.jsp. I
already try to run this on debug mode and make a break point in action
listener in this line "request.setAttribute("filename",tmp);", I can see the
tmp value is changing. the second break point I made it in the jsp page in
this line "tempfile = (String) request.getAttribute("fileName");", I can see
the value of tempfile is the correct value which is passed from the action
listener.

my question is:
Is there any way to include a page dynamically in a AjaxAywhere’s ZoneJSF
and refresh/reload only the zoneJSF without reloading the whole page? or is
there any suggestion?

Thanks

Pdt
-- 
View this message in context: 
http://www.nabble.com/Problem-with-Trinidad-1.0.1-AjaxAnywhere-1.2.1-tf4222892.html#a12012805
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to