<?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>breddy.net &#187; java</title>
	<atom:link href="http://www.breddy.net/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.breddy.net</link>
	<description>Personal and professional weblog of Chris Bredesen</description>
	<lastBuildDate>Sun, 02 May 2010 20:05:46 +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>Environmental Config Files</title>
		<link>http://www.breddy.net/2007/02/03/environmental-config-files/</link>
		<comments>http://www.breddy.net/2007/02/03/environmental-config-files/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 18:33:41 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2007/02/03/environmental-config-files/</guid>
		<description><![CDATA[I came across something disturbing recently and I want to get my two cents on the table because this isn&#8217;t the first time it&#8217;s come up.  Several components in the project I&#8217;m assigned to store various configuration attributes in text files.  Whether they&#8217;re name-value (properties) files or XML data, this is a good [...]]]></description>
			<content:encoded><![CDATA[<p>I came across something disturbing recently and I want to get my two cents on the table because this isn&#8217;t the first time it&#8217;s come up.  Several components in the project I&#8217;m assigned to store various configuration attributes in text files.  Whether they&#8217;re name-value (properties) files or XML data, this is a good choice because it allows the customization of application behavior without code changes or redeployment &#8230; if you do it properly.<br />
<span id="more-60"></span><br />
What I encountered in several places is a conf directory which contained subdirectories which resemble the following:  /local, /dev, /test, /stg, /prod.</p>
<p>At first glance, this looks completely reasonable especially if you consider that each corresponding environment declares a container-level variable whose value is one of the directory names (Development/Integration=dev, UAT/Test=test, etc.).  Developers get to configure each environment and at deployment time  the server simply knows how to behave based on the preset environment variable.  Sounds OK, right?</p>
<p>NO!  It isn&#8217;t OK.  It is horrible and you should never do it.  Packaging configuration in with code leaves the <em>System Administrator</em> powerless to <em>administer</em> the <em>system</em>.  See the problem?  No?  Here are more reasons:</p>
<ul>
<li>Configuration changes require a redeployment of the application (possibly even repackaging)</li>
<li>Developers may not (indeed, <em>should</em> not) be privy to certain config information (passwords, let&#8217;s say) for production environments</li>
<li>Test environments of the same &#8220;level&#8221; can&#8217;t have differing configuration unless you jump through hoops like branching source code</li>
<li>Turning a dev/test/stage box into a production one (or vice versa) with one small change is just scary</li>
<li>A developer can change production and nobody will notice until the code gets to production!</li>
<li><strong>A developer can change production and nobody will notice until the code gets to production!</strong></li>
<li><strong>A DEVELOPER CAN CHANGE PRODUCTION AND NOBODY WILL NOTICE UNTIL THE CODE GETS TO PRODUCTION!</strong></li>
</ul>
<p>Get it?</p>
<p>The way to manage configuration is to provide a nicely-commented <em>prototype</em> config file (that can&#8217;t/won&#8217;t be read) with your application and leave the runtime configuration in a file outside the deployed application path.  There are many ways to make such files available to your program regardless of whether you&#8217;re using a container or not.  You can:</p>
<ul>
<li>Add a <tt>conf</tt> directory to the runtime classpath</li>
<li>Put the config files in a known directory such as <tt>common/classes</tt> on Tomcat</li>
<li>Jar them up and name them according to environment, if you just absolutely must not let the admins touch them.</li>
</ul>
<p>Any of these tactics work.  As long as you aren&#8217;t marrying code and configuration, you can&#8217;t miss.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2007/02/03/environmental-config-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Too Many Choices?</title>
		<link>http://www.breddy.net/2006/08/08/too-many-choices/</link>
		<comments>http://www.breddy.net/2006/08/08/too-many-choices/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 00:58:06 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/08/08/too-many-choices/</guid>
		<description><![CDATA[Thinking about beginning a new JEE project is as unsettling as it is exciting.  On the one hand, you&#8217;re going to get your hands dirty with some new and challenging business problem to solve, you can use the latest and greatest JVM and of course let&#8217;s not forget the choice of many excellent application/persistence/web [...]]]></description>
			<content:encoded><![CDATA[<p>Thinking about beginning a new JEE project is as unsettling as it is exciting.  On the one hand, you&#8217;re going to get your hands dirty with some new and challenging business problem to solve, you can use the latest and greatest JVM and of course let&#8217;s not forget the <strong>choice</strong> of many excellent application/persistence/web frameworks.  On the other hand, you have &#8230; the choice of <strong>many</strong> excellent application/persistence/web frameworks!</p>
<p>I think we can all agree that choice is good, but is the sheer number of non-trivial frameworks really unifying the java community, or are we breeding segments of the population who know only a subset of what&#8217;s out there?</p>
<p>When you&#8217;re an ASP guy, you pretty much have you work cut out for you.  Same goes for the new kid on the block Ruby [on Rails].  But Java, in its maturity, has brought so many innovations to market that one could make an entire project out of evaluating frameworks for use in any given project!</p>
<p>The days of Struts &#038; JDBC are pretty much over, kids.  Do you use Spring at the web tier?  How &#8217;bout JSF or Tapestry or WebWork?  Do you decorate with SiteMesh, or assemble with Tiles?  Maybe you are into JSP includes or writing a lot of custom tags.  Do you manage your middle tier with Spring, or opt for the latest appserver&#8217;s EJB3 implementation?  It might seem like everyone is using Hibernate for persistence, but it aint the only kid on the block.  TopLink Essentials is bundled with GlassFish and other EE5 offerings will be supporting JPA as well.  This is just the tip of the iceberg.</p>
<p>How do you decide?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/08/08/too-many-choices/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Accessing a JBoss EJB3 Session Bean With Spring</title>
		<link>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/</link>
		<comments>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 17:34:09 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/</guid>
		<description><![CDATA[Spring and Hibernate have long been my choice of frameworks with which to construct maintainable, scalable middle-tier software.  Spring promotes good OO design using loose coupling and provides excellent declarative transaction support.  Hibernate is the persistence tool of choice for the open source community.  Any sane person who programs this way will [...]]]></description>
			<content:encoded><![CDATA[<p>Spring and Hibernate have long been my choice of frameworks with which to construct maintainable, scalable middle-tier software.  Spring promotes good OO design using loose coupling and provides excellent declarative transaction support.  Hibernate is the persistence tool of choice for the open source community.  Any sane person who programs this way will have given up on EJB long ago.  Coarse-grained entities, tightly coupled service objects and XML deployment descripters a-plenty are enough to bring a guy to his knees.</p>
<p>But no more.  The EJB expert group, now composed of some of the very creators of modern persistence framework, has bequeathed upon us something wonderful.  The lightweight POJO programming model we have come to love is apparent everywhere in the EJB 3.0 specifiction (<a title="JSR-220" href="http://www.jcp.org/en/jsr/detail?id=220" target="_blank">JSR-220</a>), which was <a title="JSR-220 voting results" href="http://www.jcp.org/en/jsr/results?id=3768" target="_blank">unanimously accepted</a> by the <a title="Java Community Process" href="http://www.jcp.org" target="_blank">JCP</a> earlier this year.  EJB 3.0 is just one goodie in the larger <a title="Java EE 5 What's New" href="http://java.sun.com/javaee/overview/whatsnew.jsp" target="_blank">Java EE 5</a> (<a title="JSR-244" href="http://www.jcp.org/en/jsr/detail?id=244" target="_blank">JSR-244</a>) bag &#8211; but this post is going to be long enough as it is.<span id="more-40"></span></p>
<p>When I returned from Las Vegas with my newfound interest in EJB, my first task at hand was to create a little test application that demonstrated the scenario that is most applicable to my work:  EJB3 services remoted over RMI consumed with POJO web applications that already use Spring.  This use case stems from the need that we have realized the need to segment a growing middle-tier application from the monolithic beast it is destined to become into smaller, more manageable services.  The client programs (mostly web applications) already access the business interfaces using Spring.</p>
<p>I&#8217;m going to skip the gory details of setting up the server, creating a project and all the like.  There are plenty of explanations of this elsewhere.  Besides, this post is going to be long enough as it is.</p>
<p>First we need a business interface.  How about something really complex:</p>
<p>[java]<br />
public interface SimpleService {<br />
int stringLength(String string);<br />
}<br />
[/java]</p>
<p>Nothing fancy there.  Now let&#8217;s implement it with some logic:</p>
<p>[java]<br />
public class SimpleServiceBean implements SimpleService {<br />
public int stringLength(String string) {<br />
return string == null ? 0 : string.length();<br />
}<br />
}<br />
[/java]</p>
<p>Still totally straightforward.  Now let&#8217;s turn our bean into an EJB.  This is the <em>really</em> complicated part.  Watch for the annotations:</p>
<p>[java]<br />
@Stateless<br />
@Remote(SimpleService.class)<br />
public class SimpleServiceBean implements SimpleService {<br />
public int stringLength(String string) {<br />
return string == null ? 0 : string.length();<br />
}<br />
}<br />
[/java]</p>
<p>Did you get all that?  The <tt>@Stateless</tt> annotation tells us that this is a Stateless Session bean, and the <tt>@Remote</tt> annotation specifies the remote interface.  <em>Everything else is handled by the container.</em> Although the footwork is managed by the container in a somewhat vendor-specific way, the annotations are standard Java EE, and so you&#8217;re not tied to an implementation. When you catch your breath, let&#8217;s move on.</p>
<p>Since Java EE 5 has embraced configuration by exception, we don&#8217;t even need any depoyment descriptors.  These two files can be compiled, JAR&#8217;d up and deployed to a server of your choosing &#8212; I used JBoss 4.0.4.</p>
<p>In order to have a client, we need to provide, at a minimum, the remote interfaces and any other classes or exceptions it references.  For testing, I just tossed the same JAR on the classpath since I know it contains everything I need.  Additionally, we need the Spring JARs (this test used 2.0RC1) and the JBoss client JAR&#8217;s.</p>
<p>The only real programming we have to do here is to create a Spring container that wires up to the server&#8217;s JNDI directory.  To do this, we&#8217;ll use Spring&#8217;s <tt>JndiObjectFactoryBean</tt>.  This part actually confused me because try as I did, I could never accomplish this feat using the more aptly-named <tt>SimpleRemoteStatelessSessionProxyFactoryBean</tt>.  The difference, apparently, is that since EJB3 places no specific requirements on the business, home or remote interfaces, there is less to do, and thus the client simply grabs the object and narrows it down as prescribed.  Here is my Spring configuration (minus the XML header and DTD info):</p>
<p>[xml]</p>
<p>org.jnp.interfaces.NamingContextFactory org.jboss.naming:org.jnp.interfaces jnp://localhost:1099<br />
[/xml]</p>
<p>The JNDI properties provided are JBoss specific, as is the provider URL.  These are included with the JBoss client JAR in the form of a jndi.properties file.  They are exactly the same as what would be used to construct a traditional <tt>InitialContext</tt> if this were a non-spring J2SE client.</p>
<p>JBoss mounts Remote interfaces (by default) using /remote, and Local interfaces using /local.  As you can see here, we&#8217;ve chosen the remote.  One could just as easily expose <tt>SimpleServiceBean</tt> as a Local EJB by using the <tt>@Local</tt> annotation and providing the same business interface as an arguement.  The Spring container changes only in URL and jndiName values.</p>
<p>Once the bean factory is configured, you can load it and request the remote <tt>SimpleServiceBean</tt> proxy by name (simpleService), casting it to <tt>SimpleService</tt> as you would normally do with a Spring-managed object.  It works flawlessly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/07/06/accessing-a-jboss-ejb3-session-bean-with-spring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Seam, EJB3 and Gavin</title>
		<link>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/</link>
		<comments>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 02:05:36 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/</guid>
		<description><![CDATA[This afternoon&#8217;s festivities were highlited by a characteristically colorful presentation by Gavin King.  For those who don&#8217;t know, Gavin is the creator of the Hibernate persistence framework which was aquired eventually by JBoss.
Gavin &#38; crew demonstrated quickly but effectively the lovely synergy that has been brought to EJB3 and JSF by their newest creation, [...]]]></description>
			<content:encoded><![CDATA[<p>This afternoon&#8217;s festivities were highlited by a characteristically colorful presentation by Gavin King.  For those who don&#8217;t know, Gavin is the creator of the <a title="Hibernate.org" href="http://www.hibernate.org/" target="_blank">Hibernate</a> persistence framework which was aquired eventually by JBoss.</p>
<p>Gavin &amp; crew demonstrated quickly but effectively the lovely synergy that has been brought to EJB3 and JSF by their newest creation, <a title="Seam homepage" href="http://labs.jboss.com/portal/jbossseam" target="_blank">Seam</a>.  Seam can hardly be called a web framework &#8212; you wouldn&#8217;t recognize it as such what with its lack of, well, just about everything that you&#8217;ve come to expect from a web framework.</p>
<p>Seam throws away boilerplate code a-la Rails, but does so in a way that leverages a lot of the untapped power of EJB3 and JSF. Seam is all about Don&#8217;t Repeat Yourself (DRY).  As such, we throw away form beans (a-la Spring MVC) and a whole lot of XML (in favor of annotations).</p>
<p>The most surprising theme that emerges from all of this is the rampant use of Stateful Session beans.  You read that right &#8211; I said Stateful.  Seam begs the question, &#8220;why on earth would I represent state in a database (slow is an understatement) or in HTTPSession (with no dirty checking) when I can use this lovely gift called Stateful beans?&#8221;  He makes a damn good point.  By representing web conversations as SFSB&#8217;s (which are POJO&#8217;s in EJB3, in case you&#8217;re wondering) you eliminate many of the headaches associated with web apps.  Multiple tabs open in your browser?  Piece of cake &#8211; each browser tab/session/window has a unique conversation (they&#8217;re <em>stateful</em>, remember?).   Double submit?  Ha!  Don&#8217;t even try!  Want to have a clean client redirect after performing some action, but still pass messages across?  No problemo &#8211; you&#8217;ve got a lightweight stateful conversation behind you.</p>
<p>By logically grouping your flows into SFSB&#8217;s, you can leverage more sophisticated failover because the container dirty-checks each instance and replicates automatically.  Try that with HTTPSession.</p>
<p>So, I will be doing a sandbox app soon with Seam, and I&#8217;ll post more as I know it.  Till then, read all you can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/06/13/seam-ejb3-and-gavin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Future of JBoss AS</title>
		<link>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/</link>
		<comments>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 20:20:08 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/06/13/the-future-of-jboss-as/</guid>
		<description><![CDATA[You can&#8217;t really question the inertia behind enterprise development using POJO&#8217;s and lightweight frameworks.  Rod Johnson (of Spring framework fame) wrote the book about this approach, effectively putting the last nail in the heavy framework&#8217;s coffin.  This morning&#8217;s presentation by JBoss covered their take on this from a 5000-ft level and also described some of [...]]]></description>
			<content:encoded><![CDATA[<p>You can&#8217;t really question the inertia behind enterprise development using POJO&#8217;s and lightweight frameworks.  Rod Johnson (of Spring framework fame) <a title="J2EE Without EJB" href="http://www.springframework.com/books/j2eewithoutEJB.html" target="_blank">wrote</a> <a title="Expert One-on-one J2EE" href="http://www.springframework.com/books/expertoneonone.html" target="_blank">the</a> <a title="Professional Java Development with the Spring Framework (Amazon.com)" href="http://www.amazon.com/gp/product/0764574833/sr=8-1/qid=1150229760/ref=pd_bbs_1/103-5528651-5807808?%5Fencoding=UTF8" target="_blank">book</a> about this approach, effectively putting the last nail in the heavy framework&#8217;s coffin.  This morning&#8217;s presentation by JBoss covered their take on this from a 5000-ft level and also described some of the new things afoot in v5 of JBoss AS.</p>
<p>JBoss is mutating their MicroKernel (heavily JMX based) into what they call the MicroContainer.  The MicroContainer architecture could be described by reading the outline of Spring&#8217;s core container and subtituting &#8220;Spring&#8221; for &#8220;JBoss&#8221;.  Indeed, they are not only building a lightweight DI framework; they are building their entire app server on it.  Cool.</p>
<p>JBoss has always been good about letting the developer/integrater customize the footprint of the server through configuration.  It looks like this is going to be even cleaner and better in v5, since the same DI engine which builds the server innerworkings can also assemble application components &#8212; all the way up through the presentation tier using Seam/JSF.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/06/13/the-future-of-jboss-as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello [JBoss] World</title>
		<link>http://www.breddy.net/2006/06/13/hello-jboss-world/</link>
		<comments>http://www.breddy.net/2006/06/13/hello-jboss-world/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 07:00:02 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/06/13/hello-jboss-world/</guid>
		<description><![CDATA[Well I&#8217;m in Vegas for the 2006 JBoss World expo.  I just ran into Marc Fleury in the elevator and he was wearing his Red Hat Fedora.  It&#8217;s going to be an interesting week.
]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;m in Vegas for the 2006 <a target="_blank" title="JBoss World" href="http://www.jbossworld.com">JBoss World</a> expo.  I just ran into Marc Fleury in the elevator and he was wearing his <a title="Red Hat Fedora" target="_blank" href="http://redhat.brandfuelstores.com/index.php?main_page=index&#038;cPath=2_17">Red Hat Fedora</a>.  It&#8217;s going to be an interesting week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/06/13/hello-jboss-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Things I Have Learned Interviewing Java Developers</title>
		<link>http://www.breddy.net/2006/05/26/java-non-facts/</link>
		<comments>http://www.breddy.net/2006/05/26/java-non-facts/#comments</comments>
		<pubDate>Fri, 26 May 2006 15:36:46 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/2006/05/26/java-non-facts/</guid>
		<description><![CDATA[I have been conducting interviews with Mid/Senior level Java developers, and I have learned some interesting facts about the language that I did not know.

If you use &#8220;==&#8221; to compare two objects such as Strings, your code will not compile.
The difference between a checked exception and and unchecked on is that you must handle a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been conducting interviews with Mid/Senior level Java developers, and I have learned some interesting facts about the language that I did not know.</p>
<ul>
<li>If you use &#8220;==&#8221; to compare two objects such as Strings, your code will not compile.</li>
<li>The difference between a checked exception and and unchecked on is that you <em>must</em> handle a checked exception and you <em>cannot</em> handle an unchecked one.</li>
<li>Omitting the access control modifier from a method reverts to the default access control which is the same as protected.</li>
<li>To pass information from a Struts Action to a JSP, you set it in the response.</li>
<li>In an MVC architecture, such as Struts, the JSP&#8217;s represent the model.</li>
</ul>
<p>Guys, if you are going to interview for a programming job, <em>brush up on the fundamentals!</em> May I suggest a <a target="_blank" title="Sun Java Certification" href="http://java.sun.com/learning/coursecert/">certification</a> or two; perhaps a <a target="_blank" title="Java Black Belt" href="http://www.javablackbelt.com/">black belt</a>?</p>
<p>Updated 5/32/2006 -CB</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/05/26/java-non-facts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Spring MVC gets Form Tags</title>
		<link>http://www.breddy.net/2006/04/27/spring-mvc-gets-form-tags/</link>
		<comments>http://www.breddy.net/2006/04/27/spring-mvc-gets-form-tags/#comments</comments>
		<pubDate>Thu, 27 Apr 2006 11:51:50 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/?p=25</guid>
		<description><![CDATA[Most seasoned Struts developers I know (myself included) are masters of the html:* tags, using and extending them liberally in just about every web application they design.  Spring MVC has been on the forefront of challengers to Struts, and with its sensible design, endless flexibility and excellent documentation, it isn&#8217;t difficult to see why. [...]]]></description>
			<content:encoded><![CDATA[<p>Most seasoned Struts developers I know (myself included) are masters of the html:* tags, using and extending them liberally in just about every web application they design.  Spring MVC has been on the forefront of challengers to Struts, and with its sensible design, endless flexibility and excellent documentation, it isn&#8217;t difficult to see why. But Spring&#8217;s MVC left the building of HTML form controls up to the developer and his own devices.  This was a big issue for me and the one that has kept me from rapidly adopting the system for use in my own apps.</p>
<p>In their 2.0 release the Spring team has given the community its wish, and provided a JSP form tag library.  It&#8217;s been <a title="Spring Form Tags" target="_blank" href="http://static.springframework.org/spring/docs/2.0.x/reference/new-in-2.html#new-in-2-web-form-tags">added to the manual</a>, but here&#8217;s a key term that might pique your interest: <strong>convention over configuration</strong>.</p>
<p>The Spring crew has taken lessons learned from the wildfire of support for <a target="_blank" title="Ruby on Rails home page" href="http://rubyonrails.org">Ruby on Rails</a> and employed them in their J2EE kit.  Bravo.  Time (and other &#8216;me-too&#8217; projects) will tell if this is really what J2EE needs to <strike>stay on</strike> return to the cutting edge.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/04/27/spring-mvc-gets-form-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Courting SpringMVC</title>
		<link>http://www.breddy.net/2006/04/19/courting-springmvc/</link>
		<comments>http://www.breddy.net/2006/04/19/courting-springmvc/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 12:48:10 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/wordpress/?p=19</guid>
		<description><![CDATA[As a Struts user since 1.x, I finally decided to come out of my Jarkarta shell and test the Spring waters.  I&#8217;ve been using Spring in the middle tier for a year or so now and could not be happier.  I&#8217;ve had only a small taste so far, but here are my initial [...]]]></description>
			<content:encoded><![CDATA[<p>As a Struts user since 1.x, I finally decided to come out of my Jarkarta shell and test the Spring waters.  I&#8217;ve been using Spring in the middle tier for a year or so now and could not be happier.  I&#8217;ve had only a small taste so far, but here are my initial thoughts:</p>
<p><strong>Good</strong></p>
<ul>
<li>Designed from the ground up using good OO principles &#8211; Rod &#038; crew really have this part mastered</li>
<li>Amazingly flexible &#8211; many concrete classes are provided for each bit of functionality so that you never get more than you need</li>
<li>Transparently woven-in with Spring &#8211; less glue code</li>
</ul>
<p><strong>Bad</strong></p>
<ul>
<li>Lack of rich HTML component library &#8211;  just doesn&#8217;t cut it when you&#8217;re used to having forms and select boxes built for you.  Apparently this is addressed in 2.0M3 which makes a new Form tag library available, but I didn&#8217;t see any reference to this in the docs.</li>
</ul>
<p>More to come as I work with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2006/04/19/courting-springmvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Korean text resources in Java</title>
		<link>http://www.breddy.net/2005/11/15/korean-text-resources-in-java/</link>
		<comments>http://www.breddy.net/2005/11/15/korean-text-resources-in-java/#comments</comments>
		<pubDate>Tue, 15 Nov 2005 15:53:54 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.breddy.net/wordpress/?p=17</guid>
		<description><![CDATA[I just spent a day or two wrestling with text resources sent to us by a Korean affiliate.  They are bits of data that must be displayed via the browser in Korean.  The process I use is outlined in the remainder of this post.

Java is Unicode-based.  That&#8217;s all well and good, but [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent a day or two wrestling with text resources sent to us by a Korean affiliate.  They are bits of data that must be displayed via the browser in Korean.  The process I use is outlined in the remainder of this post.<br />
<span id="more-17"></span><br />
Java is Unicode-based.  That&#8217;s all well and good, but it doesn&#8217;t mean that it can always deal with <em>native</em> Unicode text.  In some cases, like .properties files read from disk, the text must be <em>escaped ASCII</em>.</p>
<p>I&#8217;ve found that the easiest way to transmit text from a foreign partner using Microsoft Word.  Word stores its text as Unicode by default and is widely available and understood.  It also displays the foreign text accurately so it can be used to visually compare web page results to original documentation.  A plus if you don&#8217;t read Korean!</p>
<p>Since Java will not read files stored natively in Unicode, we need to get it into encoded ASCII format.  This is done by using the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html">native2ascii </a>tool provided with the JVM.  So how does this all fit into the software lifecycle?</p>
<p>Here&#8217;s the plan:</p>
<p>1. Obtain native text using Microsoft Word, or any text editor that can store a recognizeable native format.  Make sure you know the encoding of the original text; native2ascii will need this.  Since we carry the data in Word, the native encoding is UTF8.  Other encodings are listed <a href="http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html">here</a>.</p>
<p>2. Store a native version of the .properties file using a different extension.  I use .utf8 for UTF-8, since that seems to keep things clear.  In this copy of the file, native text can be pasted directly into the file.  Using the <a href="http://www.eclipse.org">Eclipse</a> editor, this maintains the original visual glyphs exactly like Word.</p>
<p>3. Setup an Ant task that calls native2ascii on any applicable resource directories, using UTF8 as the source encoding.  The same task can write the output files with the .properties extension.  Each type of native source file you maintain will need its own command, which can be called from a single precompile task, like such:</p>
<p>4. Deploy your application!</p>
<p>The key here is to treat the encoded ASCII resources as build artifacts, and not version them.  So for an application like ours, I store only resources_ko.utf8, not the resulting resources_ko.properties.  This allows us to maintain only the native copy, and check the properties against what comes out on the screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.breddy.net/2005/11/15/korean-text-resources-in-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
