Test Foro de elhacker.net SMF 2.1

Programación => Desarrollo Web => Mensaje iniciado por: jPallol1 en 10 Febrero 2015, 13:19 PM

Título: Quisiera pasar de Php a j2ee
Publicado por: jPallol1 en 10 Febrero 2015, 13:19 PM
Quiero hacer una preesentacion en jsp de una select.
Pero quiero presentarla asi.
En cada Celda quiero un registro, que se vea en una tabla un total de x
registros (paguinacion incluida).

El codigo lo he encontrado en Php, pero no se como presentarlo en jsp

Pido ayuda por favor


Código (php) [Seleccionar]
//CODIGO DE PHP

<?PHP
$objConnect = mysql_connect("localhost","root","") or die(mysql_error());
$objDB = mysql_select_db("otaku");

$strSQL = "SELECT *FROM serie";

$objQuery = mysql_query($strSQL);
$Num_Rows = mysql_num_rows($objQuery);

$Per_Page = 8; // Per Page

@$Page = $_GET["Page"];
if(!@$_GET["Page"])
{
$Page=1;
}

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}

$strSQL .=" order by id_serie ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);


echo"<table border=\"0\" width=\"50%\" align=\"center\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
echo "<td>";
$intRows++;
?>
<center><img with="150" height="150" src="..\<?=$objResult["imagen_principal"]; ?>"><br>
</br>
<span class="titulo"> <?=$objResult["Nombre"];?></span>

</br>
<span class="pequeño"><?=$objResult["Descripcion_p"];?></span><br />
</center>

<?php 
echo"<a href=\"eliminarserie.php?inombre='".$objResult['id_serie']."'\">ELIMINAR</a>

<a href=\"updateserie.php?inombre='"
.$objResult['id_serie']."'\">UPDATE</a> 
<a href=\"fichaserie.php?inombre='"
.$objResult['id_serie']."'\">FICHA</a>";?>

<?PHP
echo"</td>";
if(($intRows)%4==0)
{
echo"</tr>";
}
}
echo"</tr></table>";
?>

<br>
<span class="paginas">Total
<?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :</span>

<?PHP
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}

for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
?>

<?PHP
mysql_close($objConnect);
?> <br />
<a href="serie.php">INSERTAR NUEVO REGISTRO<br />
<a href="listar_galerias.php">Galerias
</a></p>
</body>
</html>


Mod: Etiquetas GeSHi OBLIGATORIAS.