<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rails y más cosas &#187; jsf (java server faces)</title>
	<atom:link href="http://www.railsymas.com/category/jsf-java-server-faces/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.railsymas.com</link>
	<description>Nuevas Tecnologías</description>
	<lastBuildDate>Fri, 30 Jul 2010 22:45:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Conexión jdbc en jsf</title>
		<link>http://www.railsymas.com/2010/07/25/conexion-jdbc-en-jsf/</link>
		<comments>http://www.railsymas.com/2010/07/25/conexion-jdbc-en-jsf/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 20:25:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1872</guid>
		<description><![CDATA[Ejemplo de conexión de una base de datos con el framework java server faces La conexión se realiza mediante un fichero de configuración datasource, siendo más flexible para el desarrollo de una aplicación, ya que si en las clases de modelos se tienen que hacer en todas y cada una de ellas una configuración de [...]]]></description>
			<content:encoded><![CDATA[<p> Ejemplo de conexión de una base de datos con el framework java server faces</p>
<p> <span id="more-1872"></span></p>
<p> La conexión se realiza mediante un fichero de configuración datasource, siendo más flexible para el desarrollo de una aplicación, ya que si en las clases de modelos se tienen que hacer en todas y cada una de ellas una configuración de los drivers específica de la aplicación, se pierde flexibilidad a la hora de extender y ampliar.</p>
<p>incorporación en el archivo web.xml del Conector</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource-ref<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>DB Connection<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;res-ref-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbc/datasource<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/res-ref-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;res-type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.sql.DataSource<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/res-type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;res-auth<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/res-auth<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>     
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource-ref<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Configuración del fichero context.xml , igual que los ejemplos explicados de j2ee</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Context</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/DBTest&quot;</span> <span style="color: #000066;">docBase</span>=<span style="color: #ff0000;">&quot;DBTest&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">debug</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">reloadable</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">crossContext</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- maxActive: Maximum number of dB connections in pool. Make sure you</span>
<span style="color: #808080; font-style: italic;">         configure your mysqld max_connections large enough to handle</span>
<span style="color: #808080; font-style: italic;">         all of your db connections. Set to -1 for no limit.</span>
<span style="color: #808080; font-style: italic;">         --&gt;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- maxIdle: Maximum number of idle dB connections to retain in pool.</span>
<span style="color: #808080; font-style: italic;">         Set to -1 for no limit.  See also the DBCP documentation on this</span>
<span style="color: #808080; font-style: italic;">         and the minEvictableIdleTimeMillis configuration parameter.</span>
<span style="color: #808080; font-style: italic;">         --&gt;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- maxWait: Maximum time to wait for a dB connection to become available</span>
<span style="color: #808080; font-style: italic;">         in ms, in this example 10 seconds. An Exception is thrown if</span>
<span style="color: #808080; font-style: italic;">         this timeout is exceeded.  Set to -1 to wait indefinitely.</span>
<span style="color: #808080; font-style: italic;">         --&gt;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- username and password: MySQL dB username and password for dB connections  --&gt;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- driverClassName: Class name for the old mm.mysql JDBC driver is</span>
<span style="color: #808080; font-style: italic;">         org.gjt.mm.mysql.Driver - we recommend using Connector/J though.</span>
<span style="color: #808080; font-style: italic;">         Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.</span>
<span style="color: #808080; font-style: italic;">         --&gt;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- url: The JDBC connection url for connecting to your MySQL dB.</span>
<span style="color: #808080; font-style: italic;">         --&gt;</span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Resource</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jdbc/datasource&quot;</span> <span style="color: #000066;">auth</span>=<span style="color: #ff0000;">&quot;Container&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;javax.sql.DataSource&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">maxActive</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">maxIdle</span>=<span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">maxWait</span>=<span style="color: #ff0000;">&quot;10000&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;root&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;root&quot;</span> <span style="color: #000066;">driverClassName</span>=<span style="color: #ff0000;">&quot;com.mysql.jdbc.Driver&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;jdbc:mysql://localhost:3306/libros_jdbc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>una vez creado los elementos necesarios para la conexión ya explicados en otros post creamos los formularios de recogida de datos y los bean asociados a los formularios</p>
<p>Bean libro.java asociado al formulariojdbc.jsp, creamos las propiedades de la tabla libros con los tres campos y sus correspondientes getters y setters</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">beans</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Libros <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> titulo<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> autor<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> tematica<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTitulo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> titulo<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTitulo<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> titulo<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">titulo</span> <span style="color: #339933;">=</span> titulo<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getAutor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> autor<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setAutor<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> autor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">autor</span> <span style="color: #339933;">=</span> autor<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTematica<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> tematica<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTematica<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tematica<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">tematica</span> <span style="color: #339933;">=</span> tematica<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Este bean es el encargado de recoger los datos del formulario, el formulario de jsf cuando detecta una etiqueta que hace referencia a un bean mediante el lenguaje de expresión intenta conectarse  siendo necesario dar de alta en el fichero faces-config.xml el bean libros</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>libroBean<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>beans.Libros<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>request<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>nombre del bean para ser usado, path y ámbito</p>
<p>Código del formulariojdbc.jsf  encargado de recoger los datos correspondientes al libro</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>formulario jsf jdbc<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;formulario libros&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;introduce el título&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libroBean.titulo}&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;introduce el autor&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libroBean.autor}&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;introduce la temática&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libroBean.tematica}&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;almacenaraction&quot;</span> actionListener<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{almacenarlibro.insertarLibro}&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Bean encargado de la tramitación de los datos a la base de datos</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>almacenarlibro<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>conexion.OperacionesConexion<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>request<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Imagen correspondiente al formulariojdbc.jsp<br />
<br/><br />
<a href="http://www.railsymas.com/wp-content/uploads/2010/07/forjsfdat.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/forjsfdat.png" alt="" title="forjsfdat" width="580" height="300" class="alignnone size-full wp-image-1884" /></a></p>
<p>Código de la página listadojsf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Listado libros<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Listado libros jdbc jsf<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabla&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>dataTable styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabla&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{almacenarlibro.listalibros}&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;libro&quot;</span> headerClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cabeceratabla&quot;</span>
 columnClasses<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;impar,par,impar&quot;</span> cellspacing<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span>  footerClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pietabla&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>T<span style="color: #339933;">&amp;</span>iacute<span style="color: #339933;">;</span>tulo<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libro.titulo}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>Autor<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libro.autor}&quot;</span><span style="color: #339933;">/&gt;</span> 
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>Tem<span style="color: #339933;">&amp;</span>aacute<span style="color: #339933;">;</span>tica<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{libro.tematica}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;footer&quot;</span> <span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span> listado tabla<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>dataTable<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/07/25/conexion-jdbc-en-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validando campos para jsf</title>
		<link>http://www.railsymas.com/2010/07/16/validando-campos-para-jsf/</link>
		<comments>http://www.railsymas.com/2010/07/16/validando-campos-para-jsf/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 22:17:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1851</guid>
		<description><![CDATA[Ejemplo de validación de algunos tipos de campos 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [...]]]></description>
			<content:encoded><![CDATA[<p> Ejemplo de validación de algunos tipos de campos </p>
<p> <span id="more-1851"></span></p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/formvalidacion.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/formvalidacion.png" alt="" title="formvalidacion" width="634" height="411" class="alignnone size-full wp-image-1864" /></a></p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/situacion11.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/situacion11.png" alt="" title="situacion11" width="580" height="400" class="alignnone size-full wp-image-1866" /></a></p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/situacion3.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/situacion3.png" alt="" title="situacion3" width="580" height="400" class="alignnone size-full wp-image-1863" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
&nbsp;
&nbsp;
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Formulario mensaje<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> Formulario Mensajes<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span> 
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText  id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nombre&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.nombre}&quot;</span>   required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>message <span style="color: #000000; font-weight: bold;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nombre&quot;</span> errorClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;errores&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.apellidos}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.apellidos}&quot;</span> required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;apellidos&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>message <span style="color: #000000; font-weight: bold;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;apellidos&quot;</span> errorClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;errores&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.edad}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText converter<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{BigInteger}&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;edad&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.edad}&quot;</span> required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> <span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>validateDoubleRange minimum<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> maximum<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;120&quot;</span> <span style="color: #339933;">/&gt;</span> 
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>inputText<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>message <span style="color: #000000; font-weight: bold;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;edad&quot;</span> errorClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;errores&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;introduce un número de teléfono&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.telefono}&quot;</span> required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;telefono&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>validateLength minimum<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;9&quot;</span><span style="color: #339933;">/&gt;</span>   
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>inputText<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>message <span style="color: #000000; font-weight: bold;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;telefono&quot;</span> errorClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;errores&quot;</span><span style="color: #339933;">/&gt;</span> 
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Introduce tu fecha de nacimiento&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.fecha}&quot;</span> required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fecha&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>convertDateTime pattern<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;M/d/yy hh:mm&quot;</span>  <span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>inputText<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>message <span style="color: #000000; font-weight: bold;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fecha&quot;</span> errorClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;errores&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;mensajeaction&quot;</span><span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton  action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cancelaraction&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cancelar&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span>  immediate<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">/&gt;</span>   
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>configuración  faces-confing.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/formulariomensajes.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mensajeaction<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/resultadomensaje.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/formulariomensajes.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cancelaraction<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/cancelada.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Código de la página resulta</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.titulo}&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
      <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
          <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tu nombre:&quot;</span><span style="color: #339933;">/&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>            
          <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
          <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tus apellidos:&quot;</span><span style="color: #339933;">/&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.apellidos}&quot;</span><span style="color: #339933;">/&gt;</span>                      
          <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
          <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tu edad:&quot;</span><span style="color: #339933;">/&gt;</span>
            <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.edad}&quot;</span><span style="color: #339933;">/&gt;</span>
          <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
          <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
           <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tu teléfono:&quot;</span><span style="color: #339933;">/&gt;</span>
           <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensajesBean.telefono}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
          <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>  
&nbsp;
&nbsp;
&nbsp;
&nbsp;
      <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
      <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
         www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span>
      <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Los mensajes de errores correspondientes </p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/propiedadeserrores.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/propiedadeserrores.png" alt="" title="propiedadeserrores" width="324" height="82" class="alignnone size-full wp-image-1894" /></a></p>
<p>Configuración del archivo face-config.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;base-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>propiedades.message<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/base-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;var<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mensaje<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/var<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;locale-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;default-locale<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>es_ES<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/default-locale<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;supported-locale<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>en<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/supported-locale<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/locale-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
&nbsp;
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>propiedades.erroresBundle<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>jsf a diferencia de struts o springframework donde los errores los validamos  bien mediante clases específicas o mediante el framework struts-validator.xml en jsf existen una serie de mensajes estandar con los cuales jugar para obtener el resultado esperado</p>
<p>Código de erroresBundle.properties</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
javax.faces.component.UIInput.REQUIRED = Campo Requerido
javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE =  No esta en el rango entre 1 y 120
javax.faces.converter.BigIntegerConverter.BIGINTEGER= {0} Tiene que ser un número
javax.faces.validator.LengthValidator.MINIMUM = El número de teléfono debe ser de nueve mínimo
javax.faces.converter.DateTimeConverter.DATE = {0} no es una fecha correcta</pre></td></tr></table></div>

<p>Dirección con gran cantidad de mensajes <a href="http://www.javadabbadoo.org/apendice/jsf/mensajesEstandar/index.html">javadabbadoo.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/07/16/validando-campos-para-jsf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ejemplo simple facelets jsf</title>
		<link>http://www.railsymas.com/2010/07/15/ejemplo-simple-facelets-jsf/</link>
		<comments>http://www.railsymas.com/2010/07/15/ejemplo-simple-facelets-jsf/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 23:58:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1831</guid>
		<description><![CDATA[Para la versión jsf 1.2 de este framework Sitio oficial para descarga de los jars https://facelets.dev.java.net/ Sitio oficial con documentación para desarrolladores https://facelets.dev.java.net/nonav/docs/dev/docbook.html modificación del archivo faces-config.xml para la visualización 1 2 3 &#60;application&#62; &#60;view-handler&#62;com.sun.facelets.FaceletViewHandler&#60;/view-handler&#62; &#60;/application&#62; modificación del fichero web.xml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 &#60;context-param&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>  Para la versión jsf 1.2 de este framework </p>
<p>  <span id="more-1831"></span></p>
<p>   Sitio oficial para descarga  de los jars <a href="https://facelets.dev.java.net/">https://facelets.dev.java.net/</a></p>
<p>   Sitio oficial con documentación para desarrolladores  <a href="https://facelets.dev.java.net/nonav/docs/dev/docbook.html">https://facelets.dev.java.net/nonav/docs/dev/docbook.html</a></p>
<p>   modificación del archivo faces-config.xml  para la visualización</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-handler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.sun.facelets.FaceletViewHandler<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-handler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>  modificación del fichero web.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>facelets.DEVELOPMENT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.faces.DEFAULT_SUFFIX<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.xhtml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;welcome-file-list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>index.xhtml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/welcome-file-list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>  modificamos el sufijo por defecto de las páginas de jsf a .xhtml</p>
<p>  los facelets nos permiten crear plantillas en jsf de una forma rápida y comoda al cambiar el manejador de las vistas todas nuestras jsp tienen que ser renombradas a xhtml pero no es obligatorio</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> </span>
<span style="color: #009900;"> <span style="color: #000066;">xmlns:f</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/core&quot;</span> <span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/facelets&quot;</span></span>
<span style="color: #009900;"> <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;../../css/estilo.css&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:insert</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;titulo&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contenedor&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;cabecera&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;ui:insert</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;cabecera&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contenido&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:insert</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;contenido&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;pie&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:insert</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pie&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p> Código de un cliente para la plantilla  clienteplantilla.xhtml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span style="color: #00bbdd;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/facelets&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
&nbsp;
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:composition</span> <span style="color: #000066;">template</span>=<span style="color: #ff0000;">&quot;plantillasimple.xhtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:define</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;cabecera&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:outputText</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Ejemplo simple con facelets&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:define<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:define</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;contenido&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:outputText</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;cuerpo de la aplicación&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:define<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:define</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pie&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;h:outputText</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;www.railsymas.com&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:define<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:composition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Resultado</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/faceletsimple.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/faceletsimple.png" alt="" title="faceletsimple" width="580" height="138" class="alignnone size-full wp-image-1843" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/07/15/ejemplo-simple-facelets-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataTable  estilos de tabla</title>
		<link>http://www.railsymas.com/2010/07/10/datatable-estilos-de-tabla/</link>
		<comments>http://www.railsymas.com/2010/07/10/datatable-estilos-de-tabla/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 21:38:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1798</guid>
		<description><![CDATA[Ejemplo para el tratamiento de datos con dataTable de jsf Declaramos el bean, con el nombre deportesBean y el path de la clase beans.Deportes y el ámbito de petición request 1 2 3 4 5 &#60;managed-bean&#62; &#60;managed-bean-name&#62;deportesBean&#60;/managed-bean-name&#62; &#60;managed-bean-class&#62;beans.Deportes&#60;/managed-bean-class&#62; &#60;managed-bean-scope&#62;request&#60;/managed-bean-scope&#62; &#60;/managed-bean&#62; Declaramos la navegación del formulario desde formulariosdeportes enviando una petición de accion deportesaction para devolver [...]]]></description>
			<content:encoded><![CDATA[<p>  Ejemplo para el tratamiento de datos con dataTable de jsf</p>
<p>  <span id="more-1798"></span></p>
<p>Declaramos el bean, con el nombre deportesBean y el path de la clase beans.Deportes y el ámbito de petición request</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deportesBean<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>beans.Deportes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>request<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Declaramos la navegación del formulario desde formulariosdeportes enviando una petición de accion deportesaction para devolver el resultado en resultadodeportes</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/formulariodeportes.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deportesaction<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/resultadodeportes.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Declaramos el bean deportes</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">beans</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Deportes <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">ArrayList</span> <span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> listaDeportes<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> getListaDeportes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> listaDeportes<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setListaDeportes<span style="color: #009900;">&#40;</span>ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> listaDeportes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">listaDeportes</span> <span style="color: #339933;">=</span> listaDeportes<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Estilo.css</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
  .cabeceratabla {
   color:#ff2223;
   text-align:center;
  }
&nbsp;
  .pietabla {
   color:#208123;
   text-align:center;
   }</pre></td></tr></table></div>

<p>formulariodeportes.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>vistas<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> Selecciona tus deportes favoritos <span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Selecciona tus deportes favoritos&quot;</span><span style="color: #339933;">/&gt;</span>
     <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>selectManyListbox value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{deportesBean.listaDeportes}&quot;</span><span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;baloncesto&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;baloncesto&quot;</span><span style="color: #339933;">/&gt;</span>
     <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;balonmano&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;balonmano&quot;</span><span style="color: #339933;">/&gt;</span>
     <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fútbol&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fútbol&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>selectManyListbox<span style="color: #339933;">&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
     <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;deportesaction&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><a href="http://www.railsymas.com/wp-content/uploads/2010/07/deportesfor1.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/deportesfor1.png" alt="" title="deportesfor" width="580" height="227" class="alignnone size-full wp-image-1803" /></a></p>
<p>Código de resultadodeportes.jsp hacemos referencia en el datatable de los estilos en el header y footer de la tabla</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Resultado deportes<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> Resultado de Deportes <span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>dataTable styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabla&quot;</span>  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{deportesBean.listaDeportes}&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;deporte&quot;</span> 
   headerClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cabeceratabla&quot;</span> footerClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pietabla&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>Listado de Deportes Seleccionados<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{deporte}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>facet name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;footer&quot;</span> <span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span> pie de tabla<span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>outputText<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>facet<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>  
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>dataTable<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>  <a href="http://www.railsymas.com/wp-content/uploads/2010/07/resultatable.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/07/resultatable.png" alt="" title="resultatable" width="580" height="207" class="alignnone size-full wp-image-1800" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/07/10/datatable-estilos-de-tabla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Etiquetas para los formularios jsf</title>
		<link>http://www.railsymas.com/2010/02/05/etiquetas-para-los-formularios-jsf/</link>
		<comments>http://www.railsymas.com/2010/02/05/etiquetas-para-los-formularios-jsf/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 21:06:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1213</guid>
		<description><![CDATA[En este post vamos a ver una serie de etiquetas que pueden ser la más utilizadas a la hora de crear un formulario, con jsf Código de la clase bean encargada del tratamiento de los datos del formulario Se necesita una clase bean para la recogida de los datos y después la diferentes páginas web [...]]]></description>
			<content:encoded><![CDATA[<p>En este post vamos a ver una serie de etiquetas que pueden ser la más utilizadas a la hora de crear un<br />
formulario, con jsf</p>
<p><span id="more-1213"></span></p>
<p>Código de la clase bean encargada del tratamiento de los datos del formulario</p>
<p>Se necesita una clase bean para la recogida de los datos y después la diferentes páginas web jsp, la configuración tanto del los bean como de las acciones en el archivo faces-config.xml </p>
<p>Bean encargado de tratar los datos</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">beans</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Etiquetas <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> nombre<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> apellidos<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> password<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> comentario<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Boolean</span> fumador<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">ArrayList</span> <span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> aficiones<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> profesion<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">ArrayList</span> <span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> lenguajes<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getProfesion<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> profesion<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setProfesion<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> profesion<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">profesion</span> <span style="color: #339933;">=</span> profesion<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> getLenguajes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> lenguajes<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setLenguajes<span style="color: #009900;">&#40;</span>ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> lenguajes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">lenguajes</span> <span style="color: #339933;">=</span> lenguajes<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> getAficiones<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> aficiones<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setAficiones<span style="color: #009900;">&#40;</span>ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> aficiones<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">aficiones</span> <span style="color: #339933;">=</span> aficiones<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Boolean</span> getFumador<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> fumador<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setFumador<span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span> fumador<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">fumador</span> <span style="color: #339933;">=</span> fumador<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getComentario<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> comentario<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setComentario<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> comentario<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">comentario</span> <span style="color: #339933;">=</span> comentario<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getNombre<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> nombre<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setNombre<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nombre<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">nombre</span> <span style="color: #339933;">=</span> nombre<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getApellidos<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> apellidos<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setApellidos<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> apellidos<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">apellidos</span> <span style="color: #339933;">=</span> apellidos<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getPassword<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> password<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setPassword<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> password<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">password</span> <span style="color: #339933;">=</span> password<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>formulario para mostrar los campos al usuario</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>loadBundle  basename<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;propiedades.message&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;mensaje&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Utilizaci<span style="color: #339933;">&amp;</span>oacute<span style="color: #339933;">;</span>n de etiquetas<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> Etiquetas html jsf <span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;imagen&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>graphicImage  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../imagenes/mundo.png&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;imagen&quot;</span><span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>   
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>  
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.apellidos}&quot;</span><span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.apellidos}&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;30&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;30&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>    
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.password}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputSecret value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.password}&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;8&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;8&quot;</span><span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>    
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.comentario}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputTextarea rows<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> cols<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;10&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.comentario}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>    
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.fumador}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>selectBooleanCheckbox value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.fumador}&quot;</span><span style="color: #339933;">/&gt;</span> 
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.profesion}&quot;</span><span style="color: #339933;">/&gt;</span>    
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>       
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>selectOneMenu value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.profesion}&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;estudiante&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Estudiante&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;programador&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Programador&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;analista&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Analista&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;diseñador&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Diseñador&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>selectOneMenu<span style="color: #339933;">&gt;</span>    
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.aficiones}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>selectManyCheckbox value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.aficiones}&quot;</span> layout<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pageDirection&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;leer&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Leer&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cine&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Cine&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;musica&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Música&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>selectManyCheckbox<span style="color: #339933;">&gt;</span>      
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.lenguajes}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>selectManyListbox value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.lenguajes}&quot;</span> <span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;c&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;C&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Java&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;struts&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Struts&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>selectItem itemValue<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;jsf&quot;</span> itemLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Jsf&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>selectManyListbox<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;etiquetasaction&quot;</span>  styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>     
&nbsp;
&nbsp;
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>   
&nbsp;
&nbsp;
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span> www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span> <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><a href="http://www.railsymas.com/wp-content/uploads/2010/02/formulariojsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/02/formulariojsf.png" alt="" title="formulariojsf" width="575" height="650" class="alignnone size-full wp-image-1250" /></a></p>
<p>jsp que muestra los resultados, se parecen al html tradicional, mencionar dataTable que sirve para mostrar datos como arrays colecciones maps etc.. . Cada valor individual viene representado por el atributo var.</p>
<p>Otra cosa a mencionar relevante, es el campo fumador que se saca en pantalla o no, según los datos introducidos,<br />
un mensaje mediante jstl se aplica la lógica a la vista</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;c&quot;</span> uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jstl/core_rt&quot;</span> <span style="color: #339933;">%&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>loadBundle basename<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;propiedades.message&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;mensaje&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;../css/estilo.css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.resultado}&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.resultado}&quot;</span><span style="color: #339933;">/&gt;</span> <span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nombre:&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>  
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;apellidos:&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.apellidos}&quot;</span><span style="color: #339933;">/&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comentario:&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.comentario}&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fumador:&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>c<span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">if</span> test<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${requestScope.etiquetasBean.fumador == true}&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;es fumador &quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>c<span style="color: #339933;">:</span>if<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>c<span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">if</span> test<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${requestScope.etiquetasBean.fumador == false }&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;no es fumador&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>c<span style="color: #339933;">:</span>if<span style="color: #339933;">&gt;</span> 
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.aficionesr}&quot;</span><span style="color: #339933;">/&gt;</span>  
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>dataTable value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.aficiones}&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;aficion&quot;</span> <span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{aficion}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>dataTable<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.profesionr}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.profesion}&quot;</span><span style="color: #339933;">/&gt;</span> 
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;campo&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.lenguajesr}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>dataTable value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{etiquetasBean.lenguajes}&quot;</span> var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;lenguaje&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{lenguaje}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>column<span style="color: #339933;">&gt;</span>
&nbsp;
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>dataTable<span style="color: #339933;">&gt;</span> 
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span> www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span> <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><a href="http://www.railsymas.com/wp-content/uploads/2010/02/resultadoetiquetas.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/02/resultadoetiquetas.png" alt="" title="resultadoetiquetas" width="575" height="400" class="alignnone size-full wp-image-1251" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/02/05/etiquetas-para-los-formularios-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilización del archivo de propiedades</title>
		<link>http://www.railsymas.com/2010/02/04/utilizacion-del-archivo-de-propiedades/</link>
		<comments>http://www.railsymas.com/2010/02/04/utilizacion-del-archivo-de-propiedades/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 17:01:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1206</guid>
		<description><![CDATA[Al igual que en otros frameworks se puede ulizar el archivo de propiedades para la declaración 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [...]]]></description>
			<content:encoded><![CDATA[<p>
Al igual que en otros frameworks se puede ulizar el archivo de propiedades para la declaración</p>
<p><span id="more-1206"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>loadBundle var<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;mensaje&quot;</span> basename<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;propiedades.message&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.titulo}&quot;</span><span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot; #{mensaje.autor}&quot;</span><span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{personaBean.nombre }&quot;</span> <span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{mensaje.edad }&quot;</span><span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
&nbsp;
&nbsp;
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{personaBean.edad}&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
 <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;personaaction&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span>  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
 <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span> 
 <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span> www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>se crea un archivo de propiedades ejemplo message.properties dentro de un package llamado propiedades</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> titulo  = Ejercicio Fichero properties
 autor  = El usuario del ejercicio 
 edad = Edad del usuario</pre></td></tr></table></div>

<p>f:view tiene que ponerse primero de f:loadboundle para que se tenga la referencia de propiedades,  el atributo var es el identificador para ser usado en la jsp, y basename es la referencia al archivo de propiedades, src, package propiedades.message  que el path al fichero properties.</p>
<p>Esto es válido para jsf 1.1 y 1.2, pero en 1.2 también se puede configurar en el faces-config.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;base-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>propiedades.message<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/base-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;var<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mensaje<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/var<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>   
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource-bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Obteniendo el mismo resultado</p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/02/04/utilizacion-del-archivo-de-propiedades/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>formulario simple con jsf</title>
		<link>http://www.railsymas.com/2010/02/03/formulario-simple-con-jsf/</link>
		<comments>http://www.railsymas.com/2010/02/03/formulario-simple-con-jsf/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 10:30:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1169</guid>
		<description><![CDATA[En este ejemplo se vera como funciona jsf con los formularios, y cual es el ciclo de ejecución de una aplicación web con jsf. Al trabajar con formularios, no solamente tenemos que trabajar con el aspecto visual, sino también con la parte del modelo de datos y de configuración. index.jsp 1 2 3 4 5 [...]]]></description>
			<content:encoded><![CDATA[<p>En este ejemplo se vera como funciona jsf con los formularios, y cual es el ciclo de ejecución de una aplicación web con jsf.</p>
<p>Al trabajar con formularios, no solamente tenemos que trabajar con el aspecto visual, sino también con la parte del modelo de datos y de configuración.</p>
<p><span id="more-1169"></span></p>
<p>index.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Insert title here<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>jsp<span style="color: #339933;">:</span>forward page<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ejercicios.jsf&quot;</span><span style="color: #339933;">/&gt;</span>  
&nbsp;
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span> 
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p> En jsf, como estamos utilizando páginas jsp, podemos hacer uso de los tags de jsp, en este caso se utiliza jps:forward para hacer un reenvio a  la página jsp de ejercicios. Esta página Ejercicios.jsp sigue siendo una página jsp pero en el reenvio utilizamos la extensión jsf. Esto es debido a que hemos configurado el fichero web xml para que responda a las páginas con la extensión jsf.</p>
<p> <a href="http://www.railsymas.com/wp-content/uploads/2010/02/form1jsf1.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/02/form1jsf1.png" alt="" title="form1jsf" width="575" height="100" class="alignnone size-full wp-image-1200" /></a></p>
<p>Ejercicios.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"> <span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Ejercicios<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enlace&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputLink value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;formulario.jsf&quot;</span><span style="color: #339933;">&gt;&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;formulario1&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>h<span style="color: #339933;">:</span>outputLink<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>   
&nbsp;
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>La página ejercicios.jsp ya contiene el contenedor de jsf f:view para mostrar los componentes jsf, un link con outputLink y outputText </p>
<p>Dentro del package beans se crea la clase usuario</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">beans</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Usuario <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> nombre<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getNombre<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> nombre<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setNombre<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nombre<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">nombre</span> <span style="color: #339933;">=</span> nombre<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Esta es la clase que va estar asociada con el formulario, necesitamos crear la clase y configurarla el el fichero faces-config.xml </p>
<p>configuracion del bean</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>usuarioBean<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>beans.Usuario<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>request<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean-scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/managed-bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>campos el bean-name hace el el id utilazado para poder usar el bean,  class es el path de la clase bean y scope es el ámbito del bean en este caso por petición</p>
<p>formulario.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span>   pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Formulario<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;css/estilo.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenedor&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;contenido&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> Formulario usuario<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>form styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;formulario&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Introduce tu nombre&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>inputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{usuarioBean.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;</span>   
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>commandButton value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;enviar&quot;</span> styleClass<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;boton&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;usuarioaction&quot;</span> <span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;/</span>h<span style="color: #339933;">:</span>form<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pie&quot;</span><span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span> www.<span style="color: #006633;">railsymas</span>.<span style="color: #006633;">com</span> <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Ahora podemos crear un formulario asociado al bean, f:view para ver los componentes jsf, y antes claro los tags jsf<br />
f y h, para core y html. Para introducir datos en el formulario inputText son campos de entrada de datos en jsf, esos datos se guardaran en el bean correspondiente, mediante el name declarado usuarioBean y con el punto accedemos a la propiedad del bean.</p>
<p>Para enviar los datos hacemos uso de commadButton value el valor visual del botón action la acción donde van los datos para ser tramitados y styleClass para hacer uso de una clase de css y modificar el aspecto visual del botón.</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/02/form1jsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/02/form1jsf.png" alt="" title="form1jsf" width="575" height="220" class="alignnone size-full wp-image-1196" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Faces Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.jsf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Cofiguración del servlet para jsf y rutas con *.jsf</p>
<p>El fichero de configuración faces-config.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/formulario.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>usuarioaction<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from-outcome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/pages/resultadousuario.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/to-view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-case<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/navigation-rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Declaración del archivo faces-confing.xml para la acción, estamos indicando que desde una página formulario.jsp se realiza una petición de acción llamada usuarioaction y el resultado se deriva a la vista /pages/resultadousuario.jsp</p>
<p>resultado usuario</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span> pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span>  uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Resultado Usuario<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Bienvenido&quot;</span><span style="color: #339933;">/&gt;</span> <span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#{usuarioBean.nombre}&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Mostramos los valores del bean mediante outputText, indicando #{nombrebean.propiedad}</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/02/resultadoform1.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/02/resultadoform1.png" alt="" title="resultadoform1" width="184" height="100" class="alignnone size-full wp-image-1197" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/02/03/formulario-simple-con-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Holamundo con jsf</title>
		<link>http://www.railsymas.com/2010/01/28/holamundo-con-jsf/</link>
		<comments>http://www.railsymas.com/2010/01/28/holamundo-con-jsf/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:07:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1158</guid>
		<description><![CDATA[En el anterior post, habíamos visto la creación de un proyecto web dinámico, y la carga de las librerías necesarias para el proyecto En jsf tenemos un fichero xml de configuración al igual que en struts, éste fichero es el faces-config.xml. y contamos con el fichero de despliegue web.xml. Una página jsf, no es más [...]]]></description>
			<content:encoded><![CDATA[<p>En el anterior post, habíamos visto la creación de un proyecto web dinámico, y la carga de las librerías necesarias para el proyecto</p>
<p><span id="more-1158"></span></p>
<p>En jsf tenemos un fichero xml de configuración al igual que en struts, éste fichero es el faces-config.xml. y contamos con el fichero de despliegue web.xml.</p>
<p>Una página jsf, no es más que una página jsp con las taglib de jsf. de las librerías jsf cargadas, </p>
<p>Importante si no hemos cargado las librerías jstl en el directorio lib del proyecto eclipse nos da la siguiente excepción</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">excepción
&nbsp;
javax.<span style="color: #006633;">servlet</span>.<span style="color: #006633;">ServletException</span><span style="color: #339933;">:</span> La ejecución del Servlet lanzó una excepción
&nbsp;
causa raíz
&nbsp;
java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">NoClassDefFoundError</span><span style="color: #339933;">:</span> javax<span style="color: #339933;">/</span>servlet<span style="color: #339933;">/</span>jsp<span style="color: #339933;">/</span>jstl<span style="color: #339933;">/</span>core<span style="color: #339933;">/</span>Config</pre></td></tr></table></div>

<p>Creamos una página jsp nueva con el nombre de index</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span>    pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Insert title here<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
  holamundo
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Ejecutamos el proyecto web y nos muesta el conocido holamundo, bien esto que parece exactamente igual que toda la vida en java para web, veremos las peculiariadades paso a paso.</p>
<p>url del proyecto http://localhost:8080/primerojsf/faces/index.jsp resultado holamundo<br />
en la barra del navegador ponemos  http://localhost:8080/primerojsf/index.jsf resultado holamundo<br />
en la barra del navegador ponemos  http://localhost:8080/primerojsf/index.faces resultado holamundo</p>
<p>Esto es debido a que en el fichero web.xml está mapeado así en el proyecto</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Faces Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/faces/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Faces Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.jsf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Faces Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.faces<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p> <a href="http://www.railsymas.com/wp-content/uploads/2010/01/holajsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/holajsf.png" alt="" title="holajsf" width="575" height="200" class="alignnone size-full wp-image-1163" /></a></p>
<p>Fragmento del web.xml donde se declara el nombre y la clase del servlet para jsf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>servlet<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>servlet<span style="color: #339933;">-</span>name<span style="color: #339933;">&gt;</span>Faces Servlet<span style="color: #339933;">&lt;/</span>servlet<span style="color: #339933;">-</span>name<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>servlet<span style="color: #339933;">-</span>class<span style="color: #339933;">&gt;</span>javax.<span style="color: #006633;">faces</span>.<span style="color: #006633;">webapp</span>.<span style="color: #006633;">FacesServlet</span><span style="color: #339933;">&lt;/</span>servlet<span style="color: #339933;">-</span>class<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>load<span style="color: #339933;">-</span>on<span style="color: #339933;">-</span>startup<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>load<span style="color: #339933;">-</span>on<span style="color: #339933;">-</span>startup<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>servlet<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Introducimos la librerías jsf en la página jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span>    pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span> <span style="color: #339933;">%&gt;</span></pre></td></tr></table></div>

<p>Mediante el atributo uri accedemos al recurso y mediante el atributo prefix, establecemos un identificador para poder hacer uso del recurso. En todos los libros de jsf suelen venir así, h y f, aunque para core se utilice f está bien, para luego no equivocarse y utilizar la librerías jstl, que tienen para su core y core_rt también el prefijo &#8220;c&#8221;.</p>
<p>El prefix se puede poner cualquiera pero se suelen utilizar estos por convención, así es más comodo leer código de otros desarrolladores</p>
<p>La etiqueta f:view establece un contenedor para de alto nivel para poder usar los componentes de la vista en jsf, sería como un jframe de java swing.</p>
<p>Mediante <h:ouputText y su atribute value mostramos el mensaje correspondiente. Esta etiqueta también es utilizada para imprimir valores de variables.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> contentType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span>    pageEncoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/html&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;h&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsf/core&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;f&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Insert title here<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h<span style="color: #339933;">:</span>outputText value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;holamundo&quot;</span><span style="color: #339933;">/&gt;</span> 
 <span style="color: #339933;">&lt;/</span>f<span style="color: #339933;">:</span>view<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/01/28/holamundo-con-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducción a jsf con eclipse</title>
		<link>http://www.railsymas.com/2010/01/22/introduccion-a-jsf-con-eclipse/</link>
		<comments>http://www.railsymas.com/2010/01/22/introduccion-a-jsf-con-eclipse/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 20:15:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf (java server faces)]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1131</guid>
		<description><![CDATA[Vamos a utilizar la versión 1.2 de jsf, para lo cual necesitamos la versión de tomcat 6.0, dando que con la versión 5.5 da problemas. Breve introducción teórica sobre jsf Jsf es un framework ( un marco de desarrollo), al igual que struts y spring, desarrollado con la tecnología java. Jsf comparte semajanzas con jsp [...]]]></description>
			<content:encoded><![CDATA[<p>Vamos a utilizar la versión 1.2 de jsf, para lo cual necesitamos la versión de tomcat 6.0, dando que con la versión 5.5 da problemas.</p>
<p>Breve introducción teórica sobre jsf</p>
<p>Jsf es un framework ( un marco de desarrollo), al igual que struts y spring, desarrollado con la tecnología java. Jsf comparte semajanzas con jsp (java server pages) y con applets de java, ya que tiene unos componentes en la vista muy potentes.</p>
<p><span id="more-1131"></span></p>
<p>Características generales</p>
<p>Representar componentes de interfaz de usuario (UI-User Interface) y manejar su estado</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/jsf1.2.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/jsf1.2.png" alt="" title="jsf1.2" width="570" height="350" class="alignnone size-full wp-image-1134" /></a></p>
<p>Se desarrolla el ejemplo sobre linux ubuntu pero es exactamente igual para windows, la configuración de tomcat seis igual que la del cinco, en este mismo sitio web se explicó en su día. </p>
<p>imagen del fichero descargado</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/jsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/jsf.png" alt="" title="jsf" width="137" height="126" class="alignnone size-full wp-image-1138" /></a></p>
<p>Creamos un nuevo proyecto web dinámico</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/parteuno.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/parteuno.png" alt="" title="parteuno" width="522" height="147" class="alignnone size-full wp-image-1150" /></a></p>
<p>y configuramos para tomcat 6.0 y para la versión 1.2 de jsf</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/parte21.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/parte21.png" alt="" title="parte2" width="575" height="200" class="alignnone size-full wp-image-1152" /></a></p>
<p>le damos a next y nos aparece una ventana de diálogo indicando el directorio de clases, volvemos a dar a next y nos aparece la ventana de diálogo de web module dejamos el nombre de proyecto y el directorio de contenido los que vienen por defecto &#8220;primerojsf&#8221; y &#8220;webcontent&#8221; y volvemos a dar a next</p>
<p>Pulsamos sobre el icono de librerias y le damos nombre</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/libreriajsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/libreriajsf.png" alt="" title="libreriajsf" width="345" height="132" class="alignnone size-full wp-image-1154" /></a></p>
<p>Ahora importamos los jar del fichero descargado para formar parte de la librería</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/librerias.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/librerias.png" alt="" title="librerias" width="244" height="149" class="alignnone size-full wp-image-1155" /></a></p>
<p>Para jsf también utilizaremos jstl, para ello tenemos que descargarnos los archivos correspondientes para crear el proyecto web dinámico de eclipse para jsf</p>
<p>Este ejemplo está sobre eclipse galileo, pero vale Europa también, lo importante es la versión 6 para Tomcat.</p>
<p>Al descomprimir el fichero descargado nos despliegan una serie de directorios, vamos al directorio lib y alli nos interesan dos jar jsf-api.jar y jsf-impl.jar. Con ellos vamos a crear una librería para incorporar cada vez que se realice un proyecto jsf en eclipse</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/jstl.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/jstl.png" alt="" title="jstl" width="523" height="347" class="alignnone size-full wp-image-1142" /></a></p>
<p>Descargamos los jar</p>
<p>Un proyecto nuevo web dinámico al igual que con j2ee, y tenemos dos opciones crear una librería con los jar descargados  </p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/jstl1.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/jstl1.png" alt="" title="jstl" width="189" height="81" class="alignnone size-full wp-image-1146" /></a></p>
<p>El proyecto primerojsf tiene la siguiente estructura de directorios</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/01/estructurajsf.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/01/estructurajsf.png" alt="" title="estructurajsf" width="234" height="426" class="alignnone size-full wp-image-1156" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/01/22/introduccion-a-jsf-con-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
