How to Create JSP Application using NetBeans

Program 1

<html>
    <head>
        <title>Reverse of Number JSP Page</title>
    </head>
    <body>
     <center>   
        <h1>Reverse of Number</h1>
        
        <form method="post" action="reverse.jsp">   
     <table border="1">
         <tr>
             <th>Enter A Number:<input type="text" name="txtno">
             <td></td>
             <td>
                 <input type="submit" value="Submit">
                 <input type="reset" value="Reset">
             </td> 
         </tr>
     </table>    
    </form>      
     <% 
         int n,s=0,r,m;
         String str=null;
         str=request.getParameter("txtno");
       if(str!=null)  
       {     
         n=Integer.parseInt(str);
         m=n;
         while(n!=0)
         {
             r=n%10;
             s=s*10+r;
             n=n/10;
         }
         out.println("<font color=red size=5>Revese is :"+s+"</font>");
         if(m==s)
           out.println("<br><font color=green size=5>No is Palindrom</font>");  
         else
          out.println("<br><font color=green size=5>No is  Not Palindrom</font>");     
       }    
     %>   
     </center>      
    </body>
</html>

 

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *