<?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>PicaTeclas &#187; jstl</title>
	<atom:link href="http://picateclas.net/posts/tag/jstl/feed/" rel="self" type="application/rss+xml" />
	<link>http://picateclas.net</link>
	<description></description>
	<lastBuildDate>Mon, 03 Jan 2011 12:10:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Acceder a una variable de scriplet con JSTL (y viceversa)</title>
		<link>http://picateclas.net/posts/acceder-a-una-variable-de-scriplet-con-jstl-y-viceversa/</link>
		<comments>http://picateclas.net/posts/acceder-a-una-variable-de-scriplet-con-jstl-y-viceversa/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 08:08:13 +0000</pubDate>
		<dc:creator>zetxek</dc:creator>
				<category><![CDATA[fragmentos útiles]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[jstl]]></category>
		<category><![CDATA[scriptlets]]></category>

		<guid isPermaLink="false">http://picateclas.net/?p=104</guid>
		<description><![CDATA[Aunque mezclar scriptlets y JSTL en las páginas JSP es una mala práctica (hace el código mucho más difícil de mantener), a veces es complicado de evitar tener que compartir variables entre código java incrustado en los JSP (scriptlets) y las etiquetas JSTL. Para poder compartir valores de variable entre ambos existe el contexto de [...]]]></description>
			<content:encoded><![CDATA[<p>Aunque mezclar <a href="http://java.sun.com/products/jsp/tags/11/syntaxref11.fm5.html">scriptlets</a> y <a href="http://java.sun.com/products/jsp/jstl/">JSTL</a> en las páginas JSP es una mala práctica (hace el código mucho más difícil de mantener), a veces es complicado de evitar tener que compartir variables entre código java incrustado en los JSP (scriptlets) y las etiquetas JSTL. Para poder compartir valores de variable entre ambos existe el contexto de la página:</p>
<h3>Acceder a una variable de un scriptlet con JSTL</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p104code6'); return false;">Ver código</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1046"><td class="code" id="p104code6"><pre class="java" style="font-family:monospace;">&lt;% String miVariable = &quot;Cadena&quot;; pageContext.setAttribute(&quot;miVariable&quot;, miVariable); %&gt;</pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p104code7'); return false;">Ver código</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1047"><td class="code" id="p104code7"><pre class="java" style="font-family:monospace;">&lt;c:out value=&quot;miVariable&quot;/&gt;</pre></td></tr></table></div>

<h3>Acceder a una variable de JSTL mediante scriptlets</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p104code8'); return false;">Ver código</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1048"><td class="code" id="p104code8"><pre class="java" style="font-family:monospace;">&lt;c:set var=&quot;miVariable&quot; value=&quot;Cadena&quot;/&gt;</pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p104code9'); return false;">Ver código</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1049"><td class="code" id="p104code9"><pre class="java" style="font-family:monospace;">&lt;%
String miVariable= (String)pageContext.getAttribute(&quot;miVariable&quot;);
out.print(miVariable);
%&gt;</pre></td></tr></table></div>

<p>Las variables usadas pueden ser objetos complejos, siempre que se importen mediante</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p104code10'); return false;">Ver código</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10410"><td class="code" id="p104code10"><pre class="java" style="font-family:monospace;">&lt;%@page import=&quot;paquete.nombre.de.la.clase&quot;%&gt;</pre></td></tr></table></div>

<p>Vía | <a href="http://www.melandri.net/2009/09/16/scriptlet-and-jstl-variable-sharing/">Alessandro Melandri</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://picateclas.net/posts/acceder-a-una-variable-de-scriplet-con-jstl-y-viceversa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

