<?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>hugomonteiro.net &#187; web</title>
	<atom:link href="http://hugomonteiro.net/tag/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://hugomonteiro.net</link>
	<description>&#34;When two men in business always agree, one of them is unnecessary.&#34; - William Wrigley Jr.</description>
	<lastBuildDate>Wed, 14 Dec 2011 00:12:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Deploying PlayFramework Apps in JBoss</title>
		<link>http://hugomonteiro.net/2010/04/01/deploying-playframework-apps-in-jboss/</link>
		<comments>http://hugomonteiro.net/2010/04/01/deploying-playframework-apps-in-jboss/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 17:19:57 +0000</pubDate>
		<dc:creator>Hugo Monteiro</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hugomonteiro.net/?p=352</guid>
		<description><![CDATA[After you created your web application you need to create the WAR file that will insert the framework and other dependent libs inside the folder that you specify: play war myapp -o myapp.war Now to deploy on JBoss, you need to do some changes on your WAR file: Create a file called jboss-web.xml in the [...]]]></description>
			<content:encoded><![CDATA[<p>After you created your web application you need to create the WAR file that will insert the framework and other dependent libs inside the folder that you specify:</p>
<pre>play war myapp -o myapp.war
</pre>
<p>Now to deploy on <a href="http://www.jboss.com/">JBoss</a>, you need to do some changes on your WAR file:</p>
<ul>
<li>Create a file called<strong><em> <strong>jboss</strong>-web.xml </em></strong>in the myapp.war/WEB-INF/ directory container the  following:</li>
</ul>
<pre class="brush: xml;" >
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;&nbsp;?&gt;
&lt;!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd"&gt;
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
com.example:archive=myapp.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
</pre>
<ul>
<li>Download hibernate-validator and hibernate annotation using the compatibility matrix (<a title="Hibernate Compatibility Matrix" href="http://74.125.77.132/search?q=cache:Q9VmeUcio1MJ:https://www.hibernate.org/6.html+https://www.hibernate.org/6.html%23A3&amp;cd=1&amp;hl=nl&amp;ct=clnk&amp;gl=nl&amp;client=safari">Hibernate Compatibility Matrix</a>).  Play is using hibernate core 3.3.2 GA. Once you are done, place the  relevant jars in the myapp.war/WEB-INF/lib directory. You should end up with:
<ul>
<li>hibernate-annotations.jar</li>
<li>hibernate-entitymanager.jar</li>
<li>hibernate-validator.jar</li>
<li>hibernate-commons-annotations.jar</li>
<li>hibernate-search-3.1.1.GA.jar</li>
<li>hibernate3.jar (Do not overwrite this library, as Play! has a modified version of it)</li>
</ul>
</li>
<li>Now that we&#8217;re prepared for WAR, you need to move your application to the deployment folder of JBoss. The default folder for it is: <em>jboss_home/server/default/deploy </em>(jboss_home == folder of jboss). There are some things you need to be aware of:<em><br />
</em></p>
<ol>
<li>Use a superior java version in JBoss to avoid class version errors</li>
<li>Verify that the WAR folder has the necessary permissions. In my case I needed to make a &#8220;<em>chown -R jboss myapp.war</em>&#8221; where jboss is the user that controls the jboss application server</li>
<li>Do a &#8220;<em>tail -f jboss_home/server/default/log/server.log</em>&#8221; to see if your application is being deployed. You&#8217;ve an Administration Console in <em>http://yourserverip:8080</em></li>
<li>Don&#8217;t change your routes file at runtime<em>. Stop the war, change routes and then start the war (in the administration console I said before)<br />
</em></li>
</ol>
</li>
<li>Now you should have your application working. You can access to your app at: <em>http://yourserverip:8080/myapp.war</em></li>
<li><strong>This tutorial was tested in JBoss 5.0.1</strong><em><br />
</em></li>
</ul>
<p>Thanks to <a href="http://www.twitter.com/nicolasleroux">Nicolas Leroux</a> from <a href="http://lunatech.com">lunatech.com</a> for helping me to create this tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://hugomonteiro.net/2010/04/01/deploying-playframework-apps-in-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send file to user using views</title>
		<link>http://hugomonteiro.net/2010/03/16/send-a-file-to-user-using-a-view-with-play-framework/</link>
		<comments>http://hugomonteiro.net/2010/03/16/send-a-file-to-user-using-a-view-with-play-framework/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 15:36:19 +0000</pubDate>
		<dc:creator>Hugo Monteiro</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hugomonteiro.net/?p=333</guid>
		<description><![CDATA[There are some simple steps to send a file to the user of your web application using the Play Framework: 1. After the controller is created (what I do is to copy the controller  &#8220;Application&#8221; and do a refactor rename to the name I want). Create a file named MyController (what I do is to [...]]]></description>
			<content:encoded><![CDATA[<p>There are some simple steps to send a file to the user of your web application using the <a href="http://www.playframework.org/">Play Framework</a>:</p>
<p>1. After the controller is created (what I do is to copy the controller  &#8220;Application&#8221; and do a refactor rename to the name I want).</p>
<ol>
<li>Create a file named MyController (what I do is to copy the controller  &#8220;Application&#8221; and do a rename to the name I want &#8211; in this case i chose the name MyController)</li>
<li>After this, you need to create a folder with the same name of the controller (in this case: MyController) &#8211; app/views/MyController</li>
<li>Now in the controller, you&#8217;ve to create an index method, where you&#8217;ll output data for the user, for instance:
<ol>
<li>
<pre>public static void index() {
    List users = User.all().fetch();
    render(users);
}</pre>
</li>
<li> Now you need to create a method that will create the file, or get the file somewhere:
<pre>public static void generateMyDocument() {
       File f = new File("myFile.xls");
       //now you've to edit the file, in this is case is an excel file,
       //so you can edit using a library like <a href="http://jexcelapi.sourceforge.net/">JExcelAPI</a></pre>
<pre>       //set the header with the size of the file
       response.setHeader("Content-Length", String.valueOf(f.length()));
       //set the content type, in this case is a microsoft excel
       response.contentType = "application/ms-excel";
       //send the file to the user
       renderBinary(f);
       //after I send the file, I want to return to the same page (index())
       index();
}</pre>
</li>
</ol>
</li>
<li>Now we need to create a view, inside that folder we just created (create an index.html file):
<ul>
<li>
<pre>&lt;a href="@{generateMyDocument()}"&gt;Download file&lt;/a&gt;</pre>
<p>We are calling the method from the controller. First we have the folder with the same name that will route directly to the method of the controller.Off course that we could do this:</li>
<pre>      &lt;a href="@{MyController.generateMyDocument()}"&gt;Download file&lt;/a&gt;</pre>
<p>And that&#8217;s it. The magic on the <a href="http://www.playframework.org">Play Framework</a> is done .</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://hugomonteiro.net/2010/03/16/send-a-file-to-user-using-a-view-with-play-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Play Framework + Oracle = EASY!</title>
		<link>http://hugomonteiro.net/2010/01/28/oracle-play-framework-easy/</link>
		<comments>http://hugomonteiro.net/2010/01/28/oracle-play-framework-easy/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 12:18:02 +0000</pubDate>
		<dc:creator>Hugo Monteiro</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hugomonteiro.net/?p=277</guid>
		<description><![CDATA[To configure your oracle database using the play framework you need to follow the following steps: Choose the JAR with the drivers according to your oracle&#8217;s database version and put in the lib/ directory of your web application Configure your application.conf file,  located inside the conf/ directory In the JPA Configuration Section you have to [...]]]></description>
			<content:encoded><![CDATA[<p>To configure your oracle database using the <a href="http://www.playframework.org/">play framework</a> you need to follow the following steps:</p>
<ol>
<li>Choose the <a href="http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html">JAR</a> with the drivers according to your oracle&#8217;s database version and put in the <em>lib/</em> directory of your web application</li>
<li>Configure your application.conf file,  located inside the <em>conf/</em> directory
<ul>
<li>In the JPA Configuration Section you have to choose the <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-optional-dialects">JPA (Hibernate) dialect</a>. In my case I was working with oracle10g so i had to insert in the configuration file:
<ul>
<li>
<pre>jpa.dialect=org.hibernate.dialect.Oracle10gDialect</pre>
</li>
</ul>
</li>
<li>Now you just need to add the following lines, according to your database (including username and password).
<ul>
<li>
<pre>db.url=jdbc:oracle:thin:@yourdatabaseserver:1521:dbname
db.driver=oracle.jdbc.driver.OracleDriver
db.user=yourusername
db.pass=yourpassword</pre>
</li>
</ul>
</li>
</ul>
</li>
<li>Now you just need to restart the server. He adds the database drivers automatically to the classpath of the project.</li>
<li>If you want, you can generate <a href="http://www.netbeans.org">Netbeans</a> or <a href="http://www.eclipse.org">Eclipse</a> projects, so you can open this projects with everything configured.</li>
</ol>
<p>Really easy with no XMLs!</p>
]]></content:encoded>
			<wfw:commentRss>http://hugomonteiro.net/2010/01/28/oracle-play-framework-easy/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>[Play] Iterate over objects using jQuery</title>
		<link>http://hugomonteiro.net/2010/01/12/how-to-navigate-into-each-html-element-using-jquery/</link>
		<comments>http://hugomonteiro.net/2010/01/12/how-to-navigate-into-each-html-element-using-jquery/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 14:13:49 +0000</pubDate>
		<dc:creator>Hugo Monteiro</dc:creator>
				<category><![CDATA[play]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hugomonteiro.net/?p=208</guid>
		<description><![CDATA[What if I want to navigate into each checkbox, radio of my html? You can do it pretty easily using jQuery.each function. In every checkbox element I want to send a post message to my Play Framework. ﻿﻿jQuery.each($(':checkbox'), function() { $﻿.post('@{myPlayMethod()}', { itemValue: $(this).val() }) });﻿ This code sends the html element value property to [...]]]></description>
			<content:encoded><![CDATA[<p>What if I want to navigate into each checkbox, radio of my html? You can do it pretty easily using <a href="http://docs.jquery.com/Utilities/jQuery.each">jQuery.each function</a>.</p>
<p>In every checkbox element I want to send a post message to my Play Framework.</p>
<pre>﻿﻿jQuery.each($(':checkbox'), function() {
    $﻿.post('@{myPlayMethod()}', { itemValue: $(this).val() })
});﻿</pre>
<p>This code sends the html element value property to method &#8220;<em>myPlayMethod(String itemValue)</em>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://hugomonteiro.net/2010/01/12/how-to-navigate-into-each-html-element-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

