Create a JSP page to accept a number from an user and display it in words: Example: 123 – One Two Three. The output should be in red color.

NumberWord.html

<html>
<body>
<form method=get action="NumberWord.jsp">
Enter Any Number : <input type=text name=num><br><br>
<input type=submit value="Display">
</form>
<body>
</html>

NumberWord.jsp

<html>
<body>
<font color=red>
<%! int i,n;
       String s1;
%>
<%   s1=request.getParameter("num");
         n=s1.length();
         i=0;
         do
         {
           char ch=s1.charAt(i);
           switch(ch)
            {
                case '0': out.println("Zero  ");break;
                case '1': out.println("One  ");break;
                case '2': out.println("Two  ");break;
                case '3': out.println("Three  ");break;
                case '4': out.println("Four ");break;
                case '5': out.println("Five  ");break;
               case '6': out.println("Six  ");break;
               case '7': out.println("Seven  ");break;
               case '8': out.println("Eight  ");break;
               case '9': out.println("Nine  ");break;
           }
           i++;
         }while(i<n);
%>
</font>
</body>
</html>

Comments

  1. The main motive of the Big data service providers is to spread the knowledge so that they can give more big data engineers to the world.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Excellent and informative article! The concepts are explained very clearly and are helpful for anyone looking to build strong programming skills. For learners searching for practical and career-oriented training, the Best Java Real Time Projects Online Training in Hyderabad is a great opportunity to gain real-time project experience and industry exposure. Thanks for sharing such valuable content!

    ReplyDelete
  4. Very informative and well-written article! The explanation provided here is clear and easy to understand for learners at all levels. Those who are looking to gain practical experience and job-ready skills can explore the No 1 Java Real Time Projects Online Training in Hyderabad, which offers hands-on learning with real-time projects. Thank you for sharing such useful and valuable information!

    ReplyDelete

Post a Comment

Popular posts from this blog

Write a SERVLET application to accept username and password, search them into database, if found then display appropriate message on the browser otherwise display error message.

Write a JSP program to accept the details of Account (ANo, Type, Bal) and store it into database and display it in tabular form. (Use PreparedStatement interface)