Fwd: Issues porting application from tomcat 5.0.28 to tomcat 7.0.57

59 views Asked by At

Can anyone please help me with the below. I even posted this in struts users group but no reply.

I am facing this issue after porting my application from the existing Tomcat 5.0.28 to the new tomcat 7.0.57. I am using Struts version 1.1 is something particular, the app in both the old and new environments work except for a few pages in the new env where when I click on the submit button it is directing to http://calculators/CertSsCalculator.do if I see the source of the page I see.

new environment (bombs due to //)

old environment (works fine)

The jsp is the same with no changes

Has any one see something like this and can suggest what can be tried and totally at a loss.

Here are the jsp files 

edit.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.ResultSet" %>

<%@ page import="com.javabeans.DB" %>
<%@ page import="com.javabeans.SQLGenerator" %>
<%@ page import="com.struts.utils.DateField" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<jsp:useBean id="CalculatorForm" class="com..struts.calculators.CalculatorForm" scope="request" >

<%
//--check login
String displayName = (String) session.getAttribute("displayName");
if(displayName == null) { response.sendRedirect( "/" );  return; }
//--get request para or session variables
String calc_id  =  (String)session.getAttribute("calc_id");
String advisorId = (String) session.getAttribute("userPID");
String clientId = (String) session.getAttribute("cclient_id");
//----set fields by database values, reset bean form
CertSsCalculatorForm.setFormId( calc_id );
CertSsCalculatorForm.setClientId( clientId );
CertSsCalculatorForm.setAdvisorId( advisorId );
CertSsCalculatorForm.reset();
%>

</jsp:useBean>


<jsp:forward page="call.jsp?"></jsp:forward>




</body>
</html>

here is the cal.jsp

<%@ page language="java" %>
<%@ taglib  uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib  uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib  uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib  uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib  uri="/WEB-INF/taglibs-datetime.tld" prefix="dt" %>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib  uri="/WEB-INF/pb.tld" prefix="pb" %>

<%

response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
//--check login
String displayName = (String) session.getAttribute("displayName");
if(displayName == null) { response.sendRedirect( "/" );  return; }
//--get request para or session variables
String cclient_name = (String) session.getAttribute("cclient_name");

%>

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link REL="shortcut icon" HREF="/images/pb.ico" TYPE="image/x-icon">
<link rel="stylesheet" type="text/css"  href="/stylesheets/pb.css" />
<link rel="stylesheet" type="text/css"  href="/stylesheets/cal.css" />
<script src="sscal_cert.js" type="text/javascript"></script>



</head>
<body onload="javascript:checkSelection();adjPiaCommenceDate( this.form );adjSSLawYear(this.form);" bgcolor="#FFFFFF" text="#000000" link="#330066" vlink="#006600" alink="#660066">
<div align="center">
<jsp:include page="/includes/nav.jsp" flush="true"/>


<!-- TABLE for body  -->
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>

<!-- COLUMN 1 for index  -->
      <td width="150" valign="top" bgcolor="#CCCCCC">
      <div align="center">
          <br/><br/><br/><br/><br/><br/><br/><br/><br/>
          <br/><br/><br/><br/><br/><br/><br/><br/><br/>
      </div>
      </td>

<!-- COLUMN 2 for spacer  -->
      <td bgcolor="#999999" width="1"><img src="/images/grey_spacer.gif" width="1" height="100%"></td>

<!-- COLUMN 3 -->
<td valign="top" align="center" width="629" background="/images/icon_background.gif">
<!-- ============================================================ -->


<!-- DIV for title -->
<div id="title" style="font:100% arial; color:#330066;" >
Social Security Calculator for
<br>
<%=cclient_name %>
</div>
<!-- DIV for nav -->
<div id="nav" style="margin-left:5px; border-bottom:1px solid #e8e8e8; font:80% arial; text-align:left; color:#330066;" >
<a href="../client/home.jsp">Back</a>
</div>






<div>
<html:errors/>
<html:form action="/calculators/Calculator" onsubmit="return validateForm();" >
<html:hidden property="minStartAge" value="10"/>
<html:hidden property="numOfAges" value="90"/>
<table class="content" width="100%">

    <tr style="display:none">
    <th class="field_name_indent" colspan="2"> Client Name </th>
    <td><html:text property="clientName" styleClass="general-input-text"/></td>
    </tr>

    <tr>
    <th class="field_name_indent" colspan="2"> Name </th>
    <td>
      <html:text property="calcName" styleClass="general-input-text"/>
    </td>
    </tr>

    <tr style="display:none">
    <th class="field_name_indent" colspan="2"> Form ID </th>
    <td><html:text property="formId" styleClass="general-input-text"/></td>
    </tr>


  <!--  -->

  <tr>
    <td class="group_title" colspan="3">
     Beneficiary Information
    </td>
  </tr>


  <tr style="display:none">
    <th class="field_name_indent" colspan="2" width="200px"> <bean:message key="general.name"/></th>
    <td >
      <html:text property="name" styleClass="general-input-text"/>
    </td>
  </tr>


<!-- INS:dob  -->
  <tiles:insert page="../datefield_read.jsp">
    <tiles:put name="property" value="dob"/>
    <tiles:put name="bean" beanName="CalculatorForm"/>
    <tiles:put name="titleKey" value="dob.title" />
  </tiles:insert>
  <tiles:insert page="../datefield.jsp">
    <tiles:put name="property" value="dob"/>
    <tiles:put name="bean" beanName="CalculatorForm"/>
    <tiles:put name="titleKey" value="dob.title" />
  </tiles:insert>
<!-- ENDINS:dob  -->



  <tr>
    <th class="field_name_indent" colspan="2">Calculation Type</th>
    <td>
      <html:radio property="retType"
    value="oldAge"
    onchange="switchDodInput( this.form )" />
      Old-Age Retirement<br/>
      <html:radio property="retType"
    value="disability"
    onchange="switchDodInput( this.form )" />Disability Retirement
    </td>
  </tr>
  <tiles:insert page="/calculators/datefield.jsp">
    <tiles:put name="property" value="dod"/>
    <tiles:put name="bean" beanName="CalculatorForm"/>
    <tiles:put name="titleKey" value="disability.date.title" />
    <tiles:put name="yearChangeJs" value="adjDisabilityDate( this.form )" />
  </tiles:insert>
  <tiles:insert page="/calculators/datefield.jsp">
    <tiles:put name="property" value="doc"/>
    <tiles:put name="bean" beanName="CalculatorForm"/>
    <tiles:put name="titleKey" value="pia.date.title" />
    <tiles:put name="yearChangeJs" value="adjEarningStopYear( this.form )" />
  </tiles:insert>
  <tr>
    <td colspan="3" class="group_sep"></td>
  </tr>
  <tr>
    <td class="group_title" colspan="3">
     Social Security Benefit Options
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> <bean:message key="sscal.law.year"/> </th>
    <td>
      <html:text property="ssLawYear" styleClass="year-input-text" size="4" maxlength="4"/>
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> <bean:message key="sscal.earning.stop.year"/> </th>
    <td>
      <html:text property="earningStopYear" styleClass="year-input-text" size="4" maxlength="4"/>
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> <bean:message key="sscal.earning.fwd.rate"/> </th>
    <td>
      <html:text property="earningFwdRate" styleClass="year-input-text" size="4" maxlength="4"/>%
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> Backward Earnings Projection</th>
    <td>
      <html:select property="earningBwdProjection" onchange="switchBwdFixedRateInput( this.form )">
 <html:option value="us_avg">US Average Wage</html:option>
 <html:option value="fixed">Fixed Rate Projection</html:option>
 <html:option value="zero">Zero Earnings</html:option>
      </html:select>
      <span id="bwdFixedRateInput" style="visibility:hidden" >
 <html:text property="earningBwdFixedRate"
     styleClass="year-input-text" size="4" maxlength="4"/>%
      </span>
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> <bean:message key="sscal.cola.rate"/> </th>
    <td>
      <html:text property="colaIncRate" styleClass="year-input-text" size="4" maxlength="4"/>%
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2"> <bean:message key="sscal.wb.rate"/> </th>
    <td>
      <html:text property="wageIncRate" styleClass="year-input-text" size="4" maxlength="4"/>%
    </td>
  </tr>
  <tr>
    <th class="field_name_indent" colspan="2 "> Earning always exceed wage base </th>
    <td>
      <html:checkbox property="earningExceedWagebase"
       onchange="switchKnownYearsInput( this.form )"/>
    </td>
  </tr>
  <tr id="knownYearsInput" style="visibility:visible">
    <th class="field_name_indent" colspan="2"> Known Earnings Years </th>
    <td>
      from <html:text property="knownEarningStartYear"
        styleClass="year-input-text"
        size="4"
        maxlength="4"/>
      to <html:text property="knownEarningStopYear"
      styleClass="year-input-text"
      size="4"
      maxlength="4"/>
      <html:submit property="subOperation" styleClass="btn">
 <c:choose>
   <c:when test='${CalculatorForm.inputEarning}'>
     <bean:message key="sscal.op.changeEarnings"/>
   </c:when>
   <c:otherwise>
     <bean:message key="sscal.op.enterEarnings"/>
   </c:otherwise>
 </c:choose>
      </html:submit>
    </td>
  </tr>
  <tr>
    <td colspan="3" class="group_sep"></td>
  </tr>
</table>
<c:if test='${CalculatorForm.inputEarning}'>
  <table class="content" width="100%" id="knownEarnings">
    <tr>
      <td class="group_title" colspan="3">
Earnings History
      </td>
    </tr>

    <tr>
      <th></th><td></td>

      <td>
 <html:button property="" styleClass="btn" onclick="resetEarnings( this.form )">
Reset all earnings
 </html:button>
      </td>

    </tr>

    <logic:iterate name="CalculatorForm"
     property="knownEarnings"
     id="knownEarningItem"
     indexId="index">
      <tr>
 <th align="right" width="190px">
   <html:hidden name="knownEarningItem" property="year" indexed="true"/>
   <c:out value="${knownEarningItem.year}"/>
 </th>
 <td width="10px"></td>
 <td>
   <html:text styleClass="general-input-text"
       name="knownEarningItem" property="value" indexed="true"/>
 </td>
      </tr>
    </logic:iterate>


    <tr>
      <td colspan="3" class="group_sep"></td>
    </tr>


  </table>
</c:if>


<!-- signature -->
<table class="content" >
<tr><td colspan="3" class="group_sep"></td></tr>
<tr>
<th class="field_name_indent" colspan="2"> Signed by </th>
<td>
    <html:select property="advisorName">
  <html:option value=""></html:option>
  <html:option value="First Last">First Last</html:option>
  <html:option value="First Last">First Last</html:option>
    </html:select>
</td>
</tr>
</table>
<table class="content" width="90%">
  <tr>
    <td colspan="3" align="center">

      <html:image property="" border="0" src="/images/submit.gif"/>

    </td>
  </tr>

</table>

<br/>
<br/>
<br/>

</html:form>
</div>


<!-- ============================================================ -->

</td>
<!-- END OF COLUMN 3 -->


</tr>
</table>
<!-- END OF TABLE for body  -->


<jsp:include page="/includes/footer.jsp" flush="true"/>
</div>
</body>
</html>

Here is the code for validateform:

function validateForm() {

    form = document.forms["CalculatorForm"];
    if ( ! validPiaCommenceDate( form ) ) {
               return false;
    } 
    return true;
  
}

function validPiaCommenceDate( form ) {

    dobYearInput = form.elements["dob.year"][0];
    dobMonthInput = form.elements["dob.monthOfYear"][0];
    dobDayInput = form.elements["dob.dayOfMonth"][0];
    
    docYearInput = form.elements["doc.year"];
    docMonthInput = form.elements["doc.monthOfYear"];
    docDayInput = form.elements["doc.dayOfMonth"];

    var valid = true;
    var dob = new Date( dobYearInput.value, dobMonthInput.value-1, dobDayInput.value );    
    var doc = new Date( docYearInput.value, docMonthInput.value-1, docDayInput.value );    
    var pia = calcPiaCommenceDate( parseInt(dobYearInput.value), parseInt(dobMonth.value), parseInt(dobDayInput.value) );

    if ( earlierThan(doc, pia) ) {
               valid = false;
               alert( "PIA Commence Date cannot be earlier than: " + (parseInt(pia.getMonth())+1) + "/" + pia.getDate() + "/" + pia.getFullYear() );
    } else {
               valid = true;
    }

    return valid;                   
}

function earlierThan( date1, date2 ) {
               var valid = false;

               y1 = date1.getFullYear();
               m1 = date1.getMonth();
               d1 = date1.getDate();

               y2 = date2.getFullYear();
               m2 = date2.getMonth();
               d2 = date2.getDate();
               
    dif_year = y2 - y1 ; 
    dif_month = m2 - m1 ; 
    dif_day = d2 - d1 ; 
    if ( dif_year>0 ) {
               valid = true;
    }
    if ( dif_year==0 && dif_month>0 ) {
               valid = true;
    }
    if ( dif_year==0 && dif_month==0 && dif_day>0 ) {
               valid = true;
    }
   
    return valid;
}

function calcPiaCommenceDate(year, month, day)
{
               var pia_year       = year + 62;
               var pia_month   = month;
               var pia_day        = day - 1 ;
               if ( month==1 && day==1 ) {
                              pia_year = year + 61;
                              pia_month = 12;
                              pia_day = 31;
               }
               if ( month==2 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==3 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 28;
               }
               if ( month==4 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==5 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 30;
               }
               if ( month==6 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==7 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 30;
               }
               if ( month==8 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==9 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==10 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 30;
               }
               if ( month==11 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 31;
               }
               if ( month==11 && day==1 ) {
                              pia_month = month-1;
                              pia_day = 30;
               }
               
    var d = new Date();
               d.setFullYear( pia_year, pia_month-1, pia_day );    
               return d;
}

1

There are 1 answers

0
user3280059 On BEST ANSWER

It seems someone already ran into this http://www.thecodingforums.com/threads/struts-html-form-resolving-action-with-double-slashes.504971/

In particular refer to the comment

My incorrect read:

<Context path="/" docBase="D:/Website/" ... >

and the correct one:

<Context path="" docBase="D:/Website/" ... >