lunes, 4 de octubre de 2010

Primer Proyecto JSP

"holaMundoJSP"

Los JSP se hacen dentro de la carpeta "WebContent": New JSP file -->Comenzamos con uno de html

El archivo queda de la siguiente manera:


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>HELLO JSPPP</title>
</head>
<body>
cuerpo del jsp/html
</body>
</html>


Ahora creamos otro JSP: "home". Enlazamos hello con home mediante un enlace dentro del body:

<a href='./home.jsp'>ir a home</a>



Para Escribir sintaxis Java en el JSP:

<%

%>



Ejemplo:

<%

    String hola="hola que tal";

    String par=request.getParameter("");

    request.getSession().getAttribute("");

    session.getServletContext().getAttribute("");

%>
 


Forma de Extraer la variable:
<%=hola %>


Donde se colocan las librerias? 
WebContent-->Web-INF-->lib

Y las clases? 
WebContent-->Web-INF-->classes

 

No hay comentarios:

Publicar un comentario