Search code examples
htmljspweb-applicationshttpsmeta-tags

Automatic web page forwarding


my registration page (empregistration.jsp)is automatically forwarding to (success.jsp) how to stop this I just want to forward it when i press submit button

empregistration.jsp

<%@ page language ="java" contentType ="text/html; charset=ISO-8859-1" pageEncoding ="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %> 
 <html>
    <head><meta http-equiv="Refresh" content="30;URL=emplogin.action">
       <sx:head/>
    <script type="text/javascript"  src ="script.js"></script>

    </head>  

      <body>
        <div align="center"> <h1 style="color: red">  ENPLOYEE REGISTRATION FORM</h1>
       <s:form  action="emplogin"  method="post" >

      <s:textfield name="firstname" label="Employee Firstname"/>
      <s:textfield name ="lastname" label ="Last name"/>  
      <s:textfield name ="id"  label="Id"/>
      <s:radio name ="gender"   list="{'male', 'female'}" label = "Gender"/>
    <sx:datetimepicker name="dob" displayFormat="dd-MMM-yyyy"  label="DOB"></sx:datetimepicker> 
      <s:radio  name ="maritalstatus" list="{'singale','married'}" label="Marital Status" />

      <s:textfield name ="email" label ="Email"/>
 <sx:datetimepicker name ="joiningdate" displayFormat="dd-MMM-yyyy" label="Joining Date"></sx:datetimepicker>

      <s:textfield name= "designation" label = "Designation"/>
      <s:textarea name ="address" label ="Address" />
      <s:textfield name = "country" label ="Country" />     
      <s:textfield name  ="state" label = "State" />
      <s:textfield name  ="city" label ="City"/> 
      <s:textfield name ="pincode" label ="Pincode"/>
      <s:textfield name ="mobileno" label="Mobile No"/>
      <s:select   name ="groups" list="{'group 1', 'group 2', 'group 3'}"  label ="Group"  cssStyle="{width:184px"/>
     <tr><td>&nbsp;</td></tr>
        <tr>
    <td>&nbsp;</td>
      <s:submit align="center"></s:submit>
      </s:form>
       </div>
    </body>
 </html>

Solution

  • <meta http-equiv="Refresh" content="30;URL=emplogin.action"> This tag in your empregistration.jsp will refresh the page.

    May be this is the problem in your code.In meta tag you have specified the URL as empLogin.action.When the page refresh it automatically invoke emplogin.action and redirects you to success.jsp. Remove this tag from your jsp.