0

I've registration.xhtml page, where user will enter data to get registered. I've written code in such a way that, if user clicks on register or Cancel button the page is refreshed and the fields become empty.But suppose if the User gives some data in the registration screen, for some reason User goes to some other page(menu1) in the application and comes back to the registration page, the data entered is still being displayed.

I need some suggestion such that each time user click on the links in header the page should be refreshed, where my header page has many links, each of which is a xhtml page Following is my header page

<html>
<f:view>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Untitled Document</title>
      <link rel="stylesheet" href="css/styles.css" type="text/css">
      <title>JSP Page</title>
    </head>
    <body bgcolor="#FFFFFF" >
     <h:form>
     <div id="navigation">
      <ul id="mainMenu">                     
       <li class="cat-item cat-item-3"><span>&nbsp;</span>
        <h:outputLink value="register.jsp" >
         <h:outputText value="Registration"/></h:outputLink>
        </li> 
        <li class="cat-item cat-item-2"><span>&nbsp;</span>
         <h:outputLink value="menu1.jsp">
          <h:outputText value="MENU1"/></h:outputLink>
        </li>
        <li class="cat-item cat-item-2"><span>&nbsp;</span>
         <h:outputLink value="menu2.jsp">
          <h:outputText value="MENU2"/></h:outputLink>
        </li>
       </div>
       </h:form>
      </body>
     </f:view>
    </html>
4

1 に答える 1

0

That can happen if the backing bean is in the session scope. A session scoped bean instance lives as long as the established HTTP session between client and server. So every single HTTP request within that session uses the very same session scoped bean instance. This is not what you want.

Put the bean in the request or view scope.

See also:

于 2012-04-20T12:38:12.630 に答える