Diseñe mi propia solución
Código JSP:
Código PHP:
<%@ page session="false" %>
<%
if(request.getParameter("sbGenerarJSP")!= null)
{
out.println("<FORM ACTION=\"http://localhost:8080/CPAG/ArrayForm.jsp\" METHOD=POST>");
out.println("Generación de Cuadros de Texto de Manera Dinámica.<P>");
out.println("Valores Obtenidos <P>\n");
int ValTemp = 0;
int tfQtty = Integer.parseInt(request.getParameter("tfQtty"));
while(ValTemp<=tfQtty)
{
String NmValue = "tf"+ValTemp;
String tfValue = request.getParameter(NmValue);
out.println("<input type=text size=6 maxlength=6 disabled = yes name = \"Ot"+ValTemp+"\" value = \""+tfValue+"\" > Valor Anterior de "+NmValue+"<P>");
ValTemp++;
}
out.println("Valores Generados <P>\n");
ValTemp = 0;
while(ValTemp<=tfQtty)
{
int tfValue = tfQtty-ValTemp;
out.println("<input type=text size=6 maxlength=6 name = \"tf"+ValTemp+"\" value = \""+tfValue+"\" >Nombre:tf"+ValTemp+"<P>");
ValTemp++;
}
out.println("<input type=text size=6 maxlength=6 name=tfQtty value=10> Cantidad <P>\n");
out.println("<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"");
out.println("<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"");
out.println("</FORM>");
//exit;
}
else if(request.getParameter("sbGenerarPHP")!= null)
{
out.println("<FORM ACTION=\"http://localhost/ArrayForm.php\" METHOD=POST>");
out.println("Generación de Cuadros de Texto de Manera Dinámica.<P>");
out.println("Valores Obtenidos <P>\n");
int ValTemp = 0;
int tfQtty = Integer.parseInt(request.getParameter("tfQtty"));
while(ValTemp<=tfQtty)
{
String NmValue = "tf"+ValTemp;
String tfValue = request.getParameter(NmValue);
out.println("<input type=text size=6 maxlength=6 disabled = yes name = \"Ot"+ValTemp+"\" value = \""+tfValue+"\" > Valor Anterior de "+NmValue+"<P>");
ValTemp++;
}
out.println("Valores Generados <P>\n");
ValTemp = 0;
while(ValTemp<=tfQtty)
{
int tfValue = tfQtty-ValTemp;
out.println("<input type=text size=6 maxlength=6 name = \"tf"+ValTemp+"\" value = \""+tfValue+"\" >Nombre:tf"+ValTemp+"<P>");
ValTemp++;
}
out.println("<input type=text size=6 maxlength=6 name=tfQtty value=10> Cantidad <P>\n");
out.println("<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"");
out.println("<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"");
out.println("</FORM>");
}
else
{
out.println("<FORM ACTION=\"http://localhost:8080/CPAG/ArrayForm.jsp\" METHOD=POST>");
out.println("Generación de Cuadros de Texto de Manera Dinámica.<P>");
int ValTemp = 0;
int tfQtty = 10;
while(ValTemp<=tfQtty)
{
int tfValue = tfQtty-ValTemp;
out.println("<input type=text size=6 maxlength=6 name = \"tf"+ValTemp+"\" value = \""+tfValue+"\" >Nombre:tf"+ValTemp+"<P>");
ValTemp++;
}
out.println("<input type=text size=6 maxlength=6 name=tfQtty value=10> Cantidad <P>\n");
out.println("<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"");
out.println("<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"");
out.println("</FORM>");
}
%>
Por parte de PHP
Código PHP:
<?php
if(isset($_POST['sbGenerarPHP']))
{
print "<FORM ACTION=\"http://localhost/ArrayForm.php\" METHOD=POST>";
Print "Generación de Cuadros de Texto de Manera Dinámica.<P>";
print "Valores Obtenidos<P>";
$ValTemp=0;
$tfQtty = $_POST['tfQtty'];
while($ValTemp<=$tfQtty)
{
$NmValue = "tf$ValTemp";
$tfValue = $_POST[$NmValue];
print "<input type=text size=6 maxlength=6 disabled = yes name = \"Ot$ValTemp\" value = \"$tfValue\" > Valor Anterior de $NmValue<P>";
$ValTemp++;
}
print "Valores Generados<P>";
$ValTemp=0;
while($ValTemp<=$tfQtty)
{
$tfValue = $tfQtty-$ValTemp;
print "<input type=text size=6 maxlength=6 name = \"tf$ValTemp\" value = \"$tfValue\" >Nombre:tf$ValTemp<P>";
$ValTemp++;
}
print "<input type=text size=2 maxlength=2 name=tfQtty value=10> Cantidad<P>\n";
print "<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"";
print "<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"";
print "</FORM>";
exit;
}
elseif(isset($_POST['sbGenerarJSP']))
{
print "<FORM ACTION=\"http://localhost:8080/CPAG/ArrayForm.jsp\" METHOD=POST>";
Print "Generación de Cuadros de Texto de Manera Dinámica.<P>";
print "Valores Obtenidos<P>";
$ValTemp=0;
$tfQtty = $_POST['tfQtty'];
while($ValTemp<=$tfQtty)
{
$NmValue = "tf$ValTemp";
$tfValue = $_POST[$NmValue];
print "<input type=text size=6 maxlength=6 disabled = yes name = \"Ot$ValTemp\" value = \"$tfValue\" > Valor Anterior de $NmValue<P>";
$ValTemp++;
}
print "Valores Generados<P>";
$ValTemp=0;
while($ValTemp<=$tfQtty)
{
$tfValue = $tfQtty-$ValTemp;
print "<input type=text size=6 maxlength=6 name = \"tf$ValTemp\" value = \"$tfValue\" >Nombre:tf$ValTemp<P>";
$ValTemp++;
}
print "<input type=text size=6 maxlength=6 name=tfQtty value=10> Cantidad <P>\n";
print "<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"";
print "<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"";
print "</FORM>";
exit;
}
else
{
print "<FORM ACTION=\"http://localhost/ArrayForm.php\" METHOD=POST>";
Print "Generación de Cuadros de Texto de Manera Dinámica.<P>";
$ValTemp=0;
$tfQtty = 10;
while($ValTemp<=$tfQtty)
{
$tfValue = $tfQtty-$ValTemp;
print "<input type=text size=6 maxlength=6 name = \"tf$ValTemp\" value = \"$tfValue\" >Nombre:tf$ValTemp<P>";
$ValTemp++;
}
print "<input type=text size=2 maxlength=2 name=tfQtty value=10> Cantidad <P>\n";
print "<input type=submit name=sbGenerarJSP value=\"Generar en JSP\"";
print "<input type=submit name=sbGenerarPHP value=\"Generar en PHP\"";
print "</FORM>";
exit;
}
?>