<%@page language="java" %>
<%!
String getPalindromeFlag(String input){
  StringBuffer strinput=new StringBuffer(input);
  String revinput=new String(strinput.reverse());
  if(input.equals(revinput))
  {
    return "是";
  }
  else
  {
    return "不是";
  }
}
%>

<%
String str1="aba";
String str2="abab";
String str3="lovevol";

String flag1=getPalindromeFlag(str1);
String flag2=getPalindromeFlag(str2);
String flag3=getPalindromeFlag(str3);
%>
<html>
  <head>
    <title>
      回文
    </title>
  </head>
  <body bgcolor="#ffffff">

    <h2 align="center">&nbsp; </h2>
    <h2 align="center">回文字符串的判断 </h2>
    <table width="300" border="1" align="center">
      <tr>
        <td>
          <div align="center">字符串</div>
        </td>
        <td>
          <div align="center">是否是回文</div>
        </td>
      </tr>
      <tr>
        <td>&nbsp;<%=str1 %></td>
        <td>&nbsp;<%=flag1 %></td>
      </tr>
      <tr>
        <td>&nbsp;<%=str2 %></td>
        <td>&nbsp;<%=flag2 %></td>
      </tr>
      <tr>
        <td>&nbsp;<%=str3 %></td>
        <td>&nbsp;<%=flag3 %></td>
      </tr>
    </table>
    <h2 align="center">&nbsp;</h2>

  </body>
</html>

