java code not working in JSP
Hi,
I am using weblogic server and written the below JSP code
<%@ page language="java" %>
<html>
<head>
<title> JSP sample</title>
</head>
<body>
<p>
<% int numTimes = Integer.parseInt(request.getParameter("numtimes")) ;
out.write("Numoftimes :" + numTimes )
for (int i = 0; i < numTimes; i++ )
{
%>
Hello World!! <BR>
<%
}
%>
</p>
<%@ include file="PageFooter.html" %>
</body>
</html>
And the corresponding HTML code from where I am calling the above JSP code is
<HTML>
<HEAD>
<TITLE>
Simple JSP Examples
</TITLE>
</HEAD>
<BODY>
<P> How many times ?</P>
<FORM METHOD="GET" ACTION= "SimpleJSP.jsp">
<INPUT TYPE="TEXT" SIZE="2" NAME="numtimes">
<INPUT TYPE= "SUBMIT">
</FORM>
</BODY>
</HTML>
However, whatever the option that I enter for the numtimes it is print Hello World only once.
I am sure that the java script code is not executing
<% int numTimes = Integer.parseInt(request.getParameter("numtimes")) ;
out.write("Numoftimes :" + numTimes )
for (int i = 0; i < numTimes; i++ )
{
%>
Hello World!! <BR>
<%
You can find the above example in professional Java book by Wrox publishers...
Any body who know the solution please post it to me....
Regards,
Srinivas.
|