<?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>Made in Software &#187; actionerrors</title>
	<atom:link href="http://www.madeinsoftware.it/index.php/tag/actionerrors/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.madeinsoftware.it</link>
	<description>In un mondo fatto di software, consigli pratici per gli sviluppatori</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:17:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Struts e i messaggi di errore</title>
		<link>http://www.madeinsoftware.it/index.php/2009/05/11/struts-e-i-messaggi-di-errore/</link>
		<comments>http://www.madeinsoftware.it/index.php/2009/05/11/struts-e-i-messaggi-di-errore/#comments</comments>
		<pubDate>Mon, 11 May 2009 07:41:17 +0000</pubDate>
		<dc:creator>dinox</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[actionerror]]></category>
		<category><![CDATA[actionerrors]]></category>
		<category><![CDATA[applicationresources]]></category>
		<category><![CDATA[errore]]></category>
		<category><![CDATA[struts]]></category>
		<category><![CDATA[taglib]]></category>

		<guid isPermaLink="false">http://www.madeinsoftware.it/?p=57</guid>
		<description><![CDATA[Come creare un corretto messaggio di errore in Struts con ActionErrors, taglib e ApplicationResources.properties]]></description>
			<content:encoded><![CDATA[<p>Quando si lavora con Struts può essere necessario inviare a video un messaggio per l&#8217;utente che indica il tipo di errore che magari egli ha commesso nell&#8217;inserimento di un dato oppure come risposta ad un errore del sistema stesso. In questo caso si può utilizzare <strong>ActionErrors</strong>. Nella <strong>action Java</strong> dove elaborate le informazioni dovrete creare queste quattro linee di codice:</p>
<p><code>ActionErrors errors = new ActionErrors();<br />
ActionError error = new ActionError("error.nomeNonPresente");<br />
errors.add(ActionErrors.GLOBAL_ERROR, error);<br />
saveErrors(request, errors);</code></p>
<p>dove <em>error.nomeNonPresente</em> è stato definito nell&#8217;<em>ApplicationResources.properties</em>.</p>
<p><strong>Nella pagina</strong> dove volete visualizzare l&#8217;errore dovrete invece inserire quanto segue:</p>
<p><code>&lt;html:messages id="error"&gt;<br />
&lt;c:out value="${error}"/&gt;<br />
&lt;/html:messages&gt;</code></p>
<p>Non dimenticate di includere nella pagina stessa la chiamata alle giuste taglib (nel nostro caso abbiamo usato quelle di Struts):</p>
<p><code>&lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt;<br />
&lt;%@ taglib uri="/WEB-INF/c.tld" prefix="c" %&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.madeinsoftware.it/index.php/2009/05/11/struts-e-i-messaggi-di-errore/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
