QuickStart Guide es
From Documentation
Jump to: navigation, search QuickStart Guide es Need the English Version? Translated by Sergio Cerro Pascual
Contents
[hide]
1 Antes de empezar o 1.1 Nuevo contenedor de servlets (Servidor Web Java)? o 1.2 Eres nuevo en el lenguaje Java? 2 Preparando un entorno para ejecutar ZK o 2.1 Prerrequisitos 2.1.1 Obteniendo el Kit de Desarrollo SE (JDK)' 2.1.2 Obteniendo un servidor de aplicaciones - Apache Tomcat 2.1.3 Obteniendo la librera de ZK o 2.2 Preparando el IDE Eclipse (Recomendado) 2.2.1 Instalando Eclipse 2.2.2 Instalando K Studio 2.2.3 Definiendo el Servidor de aplicaciones (Apache Tomcat) 2.2.4 Configurando la librera ZK 3 Running a sample application o 3.1 No installation required o 3.2 Running a sample application 3.2.1 Downloading the ZK demo 3.2.2 Running the sample application without an IDE 3.2.3 Ejecutando la aplicacin de ejemplo con un IDE 3.2.4 Ejecutar la aplicacin de ejemplo en otros servidores de aplicaciones 3.2.4.1 IBM WebSphere 3.2.4.2 BEA WebLogic 3.2.4.3 JBoss 3.2.4.4 Oracle OC4J and Oracle OPMN Release 3 3.2.4.5 Liferay 3.2.4.6 Pluto 3.2.4.7 Jetty 3.2.4.8 Resin 4 Creando una aplicacin "Hola Mundo" desde cero (sin IDE) o 4.1 Creando un proyecto web o 4.2 Desplegando la librera ZK o 4.3 Creando el fichero "web.xml"
4.4 Crea el fichero "zk.xml" 4.5 Creando tu primera pgina web 4.6 Ejecuta tu aplicacin 5 Creando una aplicacin "hola mundo" desde cero (con un IDE) o 5.1 Creando un nuevo Proyecto ZK o 5.2 Creando un nuevo fichero ZUL o 5.3 Running the ZUL file
o o o
Antes de empezar
Nuevo contenedor de servlets (Servidor Web Java)?
Antes de desarrollar aplicaciones web java (y ejecutar la demo ZK en tu mquina), necesitas instalar un contenedor de Servlets. Apache Tomcat es uno de los ms populares contenedores de Servlets, debido a su facilidad de uso y de instalacin.
Prerequisitos
Descripcin
Documentacin http://tomcat.apache.org/tomcat-6.0-doc/index.html
Eres nuevo en el lenguaje Java?
No necesitas conocer Java para usar ZK, todas las interfaces de usuario ricas pueden ser implementadas en un HTML - como lenguaje de marcas denominado ZUML-. Sin embargo, para completar una aplicacin web, t o tu equipo necesitaris algunos conocimientos bsicos de java. Aqu estn algunos de los mejores tutoriales.
Java Basico
URLs http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html http://java.sun.com/docs/books/tutorial/java/concepts/index.html
Clases y Objetos http://java.sun.com/docs/books/tutorial/java/javaOO/index.html http://java.sun.com/docs/books/tutorial/java/IandI/index.html
Preparando un entorno para ejecutar ZK
Prerrequisitos
Si an no tienes instaladas las siguientes aplicaciones en tu ordenador, por favor, descarga e instlalas primero.
Java SE Development Kit (JDK) Servidor de aplicaciones Librera ZK
Obteniendo el Kit de Desarrollo SE (JDK)'
1. Descarga JDK 6 Update 14. 2. Sigue los pasos de este tutorial Installation instructions para completar la instalacin
Obteniendo un servidor de aplicaciones - Apache Tomcat
1. Descarga Apache Tomcat 6.0 2. Sigue el siguiente tutorial Apache Setup instructions para completar la instalacin. Nota: Recomendamos que uses el puerto 8080.
Obteniendo la librera de ZK
1. De ZK Studio 0.9.4, esta empaquetado con la ltima versin estable de la librera ZK, actualmente ZK3.6.1. 2. Descarga la ltima versin de ZK library. 3. Descomprime zk-bin-xxx.zip en tu disco duro, (e.g. C:\), por favor, consulta here para conocer la lista de archivos y directorios que se incluyen en la distribucin de ZK.
Preparando el IDE Eclipse (Recomendado)
Instalando Eclipse
1. Descarga e instalalo desde Eclipse IDE for Java EE Developers
Instalando K Studio
Sigue paso a paso el siguiente tutorial Installation Guide to install ZK Studio.
Definiendo el Servidor de aplicaciones (Apache Tomcat)
1. 2. 3. 4. desde el menu ve a Windows > Preferences... Selecciona Server > Runtime Environments, then click Add Selecciona Apache > Apache Tomcat v6.0 and haz click en Next Navega hasta seleccionar Apache Tomcat directorio raz e.g. C:\Program Files\Apache Software Foundation\Tomcat 6.0
5. Haz Click Finish
Configurando la librera ZK
ZK estudio ya viene con la librera ZK(por ejemplo, ZK 3.6.1) no necesitas configurarla. Para ms informacin, por favor, dirgete a How to Import ZK library
Running a sample application
No installation required
Visit ZK Demo to experience the simplicity and richness of ZK right NOW!
Running a sample application
Notice: Make sure you have installed the following packages: 1. Java JDK 2. An Application Server (Tomcat) 3. Eclipse (OPTIONAL) IF you have NOT installed these packages please refer to the previous chapter.
Downloading the ZK demo
1. Download zk-demo-3.6.1.zip. 2. Unzip zk-demo-3.6.1.zip, to say C:\
Running the sample application without an IDE
1. Copy zkdemo.war (eg. C:\zk-demo-3.6.1\zkdemo.war). to the $TOMCAT_HOME\webapps directory. 2. Start Apache Tomcat. 3. Open your browser and navigate to http://localhost:8080/zkdemo/userguide.
Ejecutando la aplicacin de ejemplo con un IDE
1. Select File(fichero) > Import(importar) . 2. En el dilogo de la opcin "importar", selecciona Web > WAR file y posteriorente haz click en Next (siguiente). 3. Usa el botn "Browse" para localizar el fichero "zkdemo.war" (e.g. C:\zkdemo-3.6.1\zkdemo.war). 4. Haz click en Finish para importar el proyecto web. 5. Haz click con el botn derecho del ratn en el proyecto zkdemo que aparece en el navegador y selecciona Run As > Run on Server (ejecutar como > ejecutar en servidor) 6. Selecciona Apache > Tomcat v6.0 Server' en la ventana de dilogo del tipo de servidor y haz click en Finish (terminar)
7. Una vista ser activada, haz click en el enlace "ZK Demo" para explorar el proyecto zkdemo.
Ejecutar la aplicacin de ejemplo en otros servidores de aplicaciones
IBM WebSphere BEA WebLogic JBoss Oracle OC4J and Oracle OPMN Release 3 Liferay Pluto Jetty Resin
Creando una aplicacin "Hola Mundo" desde cero (sin IDE)
Creando un proyecto web
Sigue la estructura del proyecto anterior y crea la estructura de directorios dentro de $TOMCAT_HOME\webapps, por ejemplo MiAplicacion (eg.C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\MiAplicacion\).
+MiAplicacion +WEB-INF +lib web.xml zk.xml index.zul
Desplegando la librera ZK
Copia los siguientes ficheros jar en $TOMCAT_HOME\webapps\PROJECT NAME\WEB-INF\lib
zk-bin-3.6.0\dist\lib\*.jar zk-bin-3.6.0\dist\lib\ext\*.jar zk-bin-3.6.0\dist\lib\zkforge\*.jar
Creando el fichero "web.xml"
Copia las siguientes lineas dentro de $TOMCAT_HOME\webapps\PROJECT NAME\WEB-INF\web.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 3 xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 4 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 5 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" 6 version="2.5"> <display-name>MyApp</display-name> 7 <listener> 8 <description> 9 Used to cleanup when a session is destroyed< /description> <display-name> 10 ZK Session Cleaner</display-name> 11 <listener12class>org.zkoss.zk.ui.http.HttpSessionListener</listener -class> 13 </listener> 14 <servlet> <description> 15 The servlet loads the DSP pages.</description> 16 <servlet-name>dspLoader</servlet-name> 17 <servlet-class> 18 org.zkoss.web.servlet.dsp.InterpreterServlet</servlet -class> 19 </servlet> 20 <servlet> <description> 21 ZK loader for ZUML pages</description> 22 <servlet-name>zkLoader</servlet-name> <servlet-class> 23 org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet -class> 24 <init-param> 25 <param-name>update-uri</param-name> 26 <param-value>/zkau</param-value> 27 </init-param> <load-on-startup>1</load-on-startup> 28 </servlet> 29 <servlet> 30 <description> 31 The asynchronous update engine for ZK</description> <servlet-name>auEngine</servlet-name> 32 <servlet-class> 33 org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet -class> 34 </servlet> 35 <servlet-mapping> 36 <servlet-name>dspLoader</servlet-name> <url-pattern>*.dsp</url-pattern> 37 </servlet-mapping> 38 <servlet-mapping> 39 <servlet-name>zkLoader</servlet-name> 40 <url-pattern>*.zul</url-pattern> 41 </servlet-mapping> 42 <servlet-mapping> <servlet-name>zkLoader</servlet-name> 43 <url-pattern>*.zhtml</url-pattern> 44 </servlet-mapping> 45 <servlet-mapping> <servlet-name>auEngine</servlet-name> 46 <url-pattern>/zkau/*</url-pattern> 47 </servlet-mapping> 48 <welcome-file-list> 49 <welcome-file>index.html</welcome-file> 50 <welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file> 51 <welcome-file>default.html</welcome-file> 52 <welcome-file>default.htm</welcome-file> 53 <welcome-file>default.jsp</welcome-file> 54 <welcome-file>index.zul</welcome-file> 55 </welcome-file-list> 56</web-app> 57 58 59 60 61 62
Crea el fichero "zk.xml"
Copia las siguientes lneas dentro de $TOMCAT_HOME\webapps\PROJECT NAME\WEB-INF\zk.xml 1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-Created by ZK Studio 4 5--> 6 7<zk> 8 </zk> 9
Creando tu primera pgina web
Crea index.zul bajo $TOMCAT_HOME\webapps\PROJECT NAME\ y copia las siguientes lneas dentro. 1<window title="My First window" border="normal" width="200px"> 2Hello, World! 3</window>
Ejecuta tu aplicacin
1. Arranca Apache Tomcat. 2. Navega en tu navegador web a http://localhost:8080/MiAplicacion/.
Creando una aplicacin "hola mundo" desde cero (con un IDE)
Nota: Asegrate de haber instalado "Java JDK","Servidor de aplicaciones" y "ZK Studio" en tu PC o dirgete a previous chapter.
Creando un nuevo Proyecto ZK
Con la versin liberada de ZK Studio no tendrs que crear un nuevo proyecto web dinmico y configurar las opcin para ZK. Puedes crear un nuevo proyecto "ZK", elegir tu paquete y recostarte mientras ZK Studio hace el resto por t.
----------------------------video--------------------------
Creando un nuevo fichero ZUL
1. Haz click con el botn derecho en la carpeta WebContent en la vista Explorado de Proyectoo la vista Explorado de paquetes y selecciona New> ZUL.
2. Teclea index.zul en el nombre de fichero y haz click en Finish (terminar).
3. El nuevo fichero creado ser abierto con el editor ZUL.
Running the ZUL file
1. Haz click con el botn derecho del ratn en "MiAplicacion" y en el men emergente selecciona "Ejecutar como > Ejecutar en servidor"
2. Selecciona Apache > Tomcat v6.0 Server en la ventana de dilogo del servidor y haz click en Finish (terminar)
3. Mira el resultado en tu navegador.