<!DOCTYPE html>
<html>
<body>
<form method=get action="test.jsp">
Enter Any Number : <input type=text name=num><br><br>
<input type=submit value="Display">
</form>
</body>
</html>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<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>
<web-app>
<servlet>
<servlet-name>xyz</servlet-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>xyz</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>