tags:

views:

924

answers:

0

In my JSF project I have two pages, Page1 and Page2. And a backing-bean called Page2_backing.

Page1:

       <html id="outputHtml1">
            <head id="outputHead1">
                <ice:outputStyle id="outputStyle1" href="./resources/stylesheet.css"/>
                <ice:outputStyle id="outputStyle2" href="./xmlhttp/css/xp/xp.css"/>
                <script type="text/javascript">
                    function dispNewsGroup(id){
                        document.getElementById('if_center').src = 'Page2.iface?id=' + id;
                    }

                </script>
            </head>
            <body id="outputBody1" style="-rave-layout: grid">
                <ice:form id="form1">
                   <ice:outputLink onclick="dispNewsGroup('1');return false;" value="#">
                                <ice:outputText value='Link1' />
                   </ice:outputLink>
                   <ice:outputLink onclick="dispNewsGroup('2');return false;" value="#">
                                <ice:outputText value='Link2' />
                   </ice:outputLink>
                   <iframe id="if_center" src="http://www.google.com" />
                </ice:form>
            </body>
        </html>

In Page2.jsp, like shown above, I get the "id" parameter from the url and simply show the value in my page. But I achieve this in two different approaches. First one is simply writing #{param.id} and second way is using my backing_bean. This is exactly where I'm facing a problem. When I start to click the links in a row, the first value refreshes but second one that's coming from backing_bean doesn't. Could someone please tell me the reason of this.

Page2:

         <html id="outputHtml1">
            <head id="outputHead1">
                <ice:outputStyle id="outputStyle1" href="./resources/stylesheet.css"/>
                <ice:outputStyle id="outputStyle2" href="./xmlhttp/css/xp/xp.css"/>
            </head>
            <body id="outputBody1" style="-rave-layout: grid">
                <ice:form id="form1">
                    <ice:outputText value="#{param.id}" /><br></br>
                    <ice:outputText value="#{Page8.id}" />
                </ice:form>
            </body>
        </html>

Page2_backing:

public class Page2 {

private String id;
private HttpServletRequest request;

public Page2(){
    //id = (String)FacesContext.getCurrentInstance().getExternalContext().getInitParameterMap().get("id");
    request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    id = request.getParameter("id");
}

/**
 * @return the id
 */
public String getId() {
    return id;
}

/**
 * @param id the id to set
 */
public void setId(String id) {
    //id = (String)FacesContext.getCurrentInstance().getExternalContext().getInitParameterMap().get("id");
    id = request.getParameter("id");
    this.id = id;
}}

Thanks.