简体   繁体   中英

refresh a xhtml page

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>

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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM