<?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>Shaun Abram &#187; Java</title>
	<atom:link href="http://www.shaunabram.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunabram.com</link>
	<description>Java and Technology weblog</description>
	<lastBuildDate>Tue, 27 Jul 2010 23:14:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>HelloWorld: JSP -&gt; Servlet</title>
		<link>http://www.shaunabram.com/helloworld-jsp-servlet/</link>
		<comments>http://www.shaunabram.com/helloworld-jsp-servlet/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 23:35:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=785</guid>
		<description><![CDATA[A while ago, I posted a simple HelloWorld Html->Servlet->JSP setup. Even thought the html part is unnecessary (a jsp can obviously handle that alone), I deliberately included it as a template for Html/Servlet/JSP interaction. I have used it a bunch of times to get simple Proof of Concept projects up and running, or as a [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I posted a  simple <a href="http://www.shaunabram.com/helloworld-html-servlet-jsp/">HelloWorld Html->Servlet->JSP setup</a>. Even thought the html part is unnecessary (a jsp can obviously handle that alone), I deliberately included it as a template for Html/Servlet/JSP interaction. I have used it a bunch of times to get simple Proof of Concept projects up and running, or as a basis to create a simple browser interface to some server side process. </p>
<p>Most of the more recent projects I have used it on however have used straight JSP->Servlet, with no .html file involved. So I am now posting that setup, including some simple JSTL EL and conditional logic.</p>
<p><span id="more-785"></span><br />
The setup steps for a simple JSP-Servlet setup are as follows.</p>
<p>1) Create a JSP page called HelloWorld.jsp</p>
<pre>
<code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
&lt;%-- Note the above core tag lib will require adding the 2 jstl jars to your web app lib folder.
     You can download them from here: https://jstl.dev.java.net/download.html
--%&gt;

&lt;c:choose&gt;
	&lt;c:when test="${msg==null || msg==''}"&gt;
		&lt;c:set var="greeting" value="World" scope="page" /&gt;
	&lt;/c:when&gt;
	&lt;c:otherwise&gt;
		&lt;c:set var="greeting" value="${msg}" scope="page" /&gt;
	&lt;/c:otherwise&gt;
&lt;/c:choose&gt;

&lt;html&gt;

&lt;head&gt;
&lt;title&gt;Hello ${greeting}!&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;center&gt;Hello ${greeting}!&lt;/center&gt;
&lt;br&gt;&lt;/br&gt;

&lt;FORM ACTION="/HelloWorld/HelloWorldServlet"&gt;
	Enter greeting recipient:
	&lt;INPUT TYPE="TEXT" NAME="msg" value="${msg}"&gt;
	&lt;p&gt;&lt;/p&gt;
	&lt;INPUT TYPE="SUBMIT" VALUE="Submit"&gt;
&lt;/FORM&gt;

&lt;/body&gt;
&lt;/html&gt;</code>
</pre>
<p>2) Create a servlet to receive the user input (This is the same as in the Html->Servlet->JSP example).<br />
HelloWorldServlet.java</p>
<pre>
<code>package com.shaunabram.helloworld;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloWorldServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {

		//get inputs
		String msg = req.getParameter("msg");

		//any additional processing can be done here

		//set outputs
		req.setAttribute("msg", msg);

		//forward to jsp
		req.getRequestDispatcher("/HelloWorld.jsp").forward(req, res);
	} 

}</code>
</pre>
<p>3) Create the web application’s deployment descriptor file:<br />
web.xml</p>
<pre>
<code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app&gt;
	&lt;welcome-file-list&gt;
		&lt;welcome-file&gt;HelloWorld.jsp&lt;/welcome-file&gt;
	&lt;/welcome-file-list&gt;

	&lt;servlet&gt;
		&lt;servlet-name&gt;HelloWorldServlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;com.helloworld.HelloWorldServlet&lt;/servlet-class&gt;
	&lt;/servlet&gt;

	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;HelloWorldServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/HelloWorldServlet&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;

&lt;/web-app&gt;</code>
</pre>
<p>That&#8217;s it.<br />
Again, the easiest way I have found for this kind of development is to create in Eclipse as a Dynamic Web Project (available via the Web Tools Platform that comes with the in the “Eclipse IDE for Java EE Developers” package). When you have carried out the above steps, just right click the project -> Run As -> Run on Server (assuming you have a server like Tomcat or GlassFish setup in Eclipse…). You will also need to reference your chosen server&#8217;s servlet jar (e.g. /tomcat/lib/servlet-api.jar) file too.</p>
<p>And of course, just like the HTML wasn&#8217;t necessary in my first posting, the Servlet is strictly speaking not necessary either. It doesn&#8217;t do much and is more a placeholder for, or interface to, the server side Java logic your app may require. If you want just the  JSP implementation with no servlet involved, just use this jsp (HelloWorldNoServlet.jsp):</p>
<pre>
<code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
&lt;%-- Note the above core tag lib will require adding the 2 jstl jars to your web app lib folder.
     You can download them from here: https://jstl.dev.java.net/download.html
--%&gt;

&lt;c:choose&gt;
	&lt;c:when test="${param.msg==null || param.msg==''}"&gt;
		&lt;c:set var="greeting" value="World" scope="page" /&gt;
	&lt;/c:when&gt;
	&lt;c:otherwise&gt;
		&lt;c:set var="greeting" value="${param.msg}" scope="page" /&gt;
	&lt;/c:otherwise&gt;
&lt;/c:choose&gt;

&lt;html&gt;

&lt;head&gt;
&lt;title&gt;Hello ${greeting}!&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;center&gt;Hello ${greeting}!&lt;/center&gt;
&lt;br&gt;&lt;/br&gt;

&lt;FORM ACTION="/HelloWorld/HelloWorldNoServlet.jsp"&gt;
	Enter greeting recipient:
	&lt;INPUT TYPE="TEXT" NAME="msg" value="${param.msg}"&gt;
	&lt;p&gt;&lt;/p&gt;
	&lt;INPUT TYPE="SUBMIT" VALUE="Submit"&gt;
&lt;/FORM&gt;

&lt;/body&gt;
&lt;/html&gt;</code>
</pre>
<p>Or, use the simplest possible JSP (HelloWorldSimplestNoServlet.jsp):</p>
<pre>
<code>Hello ${param['msg']}!
&lt;br&gt;&lt;/br&gt;

&lt;FORM ACTION="/HelloWorld/HelloWorldSimplestNoServlet.jsp"&gt;
	Enter greeting recipient:
	&lt;INPUT TYPE="TEXT" NAME="msg" value="${param['msg']}"&gt;
	&lt;p&gt;&lt;/p&gt;
	&lt;INPUT TYPE="SUBMIT" VALUE="Submit"&gt;
&lt;/FORM&gt;</code>
</pre>
<p>I have attached all the in the attached <a href="http://www.shaunabram.com/attachments/HelloWorldJsp.war">HelloWorldJsp.war</a>. Be sure to import the web libraries (the jstl jars) included in the war too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/helloworld-jsp-servlet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silicon Valley Code Camp Notes</title>
		<link>http://www.shaunabram.com/attending-silicon-valley-code-camp/</link>
		<comments>http://www.shaunabram.com/attending-silicon-valley-code-camp/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 19:58:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[threading]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=22</guid>
		<description><![CDATA[I am at the Silicon Valley Code Camp at the moment. I will try to post some notes on the various talks I attend below&#8230; Day 1: Session 1: JavaScript Session 2: Easing into Agile Session 3: Building Better Tests in Java Session 4: What is Python? Day 2: Session 1: Basics of Threading Session [...]]]></description>
			<content:encoded><![CDATA[<p>I am at the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> at the moment.</p>
<p>I will try to post some notes on the various talks I attend below&#8230;</p>
<p>Day 1:</p>
<ul>
<li>Session 1: <a href="http://shaunabram.com/code-camp-javascript">JavaScript</a></li>
<li>Session 2: <a href="http://www.shaunabram.com/code-camp-easing-into-agile">Easing into Agile</a></li>
<li>Session 3: <a href="http://www.shaunabram.com/code-camp-building-better-tests-in-java">Building Better Tests in Java</a></li>
<li>Session 4: <a href="http://www.shaunabram.com/code-camp-what-is-python">What is Python?</a></li>
</ul>
<p>Day 2:</p>
<ul>
<li>Session 1: <a href="http://www.shaunabram.com/?page_id=24">Basics of Threading </a></li>
<li>Session 2: Introduction to Grails</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/attending-silicon-valley-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Workflow Management: JBoss&#8217;s JBPM</title>
		<link>http://www.shaunabram.com/workflow-mnagement-jbosss-jbpm/</link>
		<comments>http://www.shaunabram.com/workflow-mnagement-jbosss-jbpm/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 06:21:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[bpel]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jbpm]]></category>
		<category><![CDATA[jpdl]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=21</guid>
		<description><![CDATA[The project I&#8217;m currently working on had a requirement for a workflow engine to manage the various process flow options for an order management system. For example, an order can be created, modified, submitted etc and we need to be able to persist and retrieve the process at any stage as we wait for human [...]]]></description>
			<content:encoded><![CDATA[<p>The project I&#8217;m currently working on had a requirement for a workflow engine to manage the various process flow options for an order management system. For example, an order can be created, modified, submitted etc and we need to be able to persist and retrieve the process at any stage as we wait for human involvement to move to the next stage.  I have been evaluating JBoss&#8217;s JBPM. It seems to meet our requirements but has been very difficult to get up and running. Overall it has been a frustrating process so far.  The main JBoss JBPM site is at <a href="http://www.jboss.com/products/jbpm">here</a> and theServerSide has a good article on using it with <a href="http://www.theserverside.com/tt/articles/article.tss?l=jBPMandSpring">Spring/Hibernate integration</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/workflow-mnagement-jbosss-jbpm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silicon Valley Code Camp</title>
		<link>http://www.shaunabram.com/silicon-valley-code-camp/</link>
		<comments>http://www.shaunabram.com/silicon-valley-code-camp/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 22:49:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=20</guid>
		<description><![CDATA[I have signed up for this code camp next weekend&#8230; http://www.siliconvalley-codecamp.com/ There are some interesting sessions on, amongst other things, Groovy, Grails, Java, Web Services, Testing, Agile development and more. And it&#8217;s all free and ran by volunteers&#8230; I will post some feedback when the weekend is over.]]></description>
			<content:encoded><![CDATA[<p>I have signed up for this code camp next weekend&#8230;</p>
<p><a href="http://www.siliconvalley-codecamp.com/">http://www.siliconvalley-codecamp.com/</a></p>
<p>There are some interesting sessions on, amongst other things, Groovy, Grails, Java, Web Services, Testing, Agile development and more. And it&#8217;s all free and ran by volunteers&#8230;</p>
<p>I will post some feedback when the weekend is over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/silicon-valley-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>POJOs in Action</title>
		<link>http://www.shaunabram.com/18/</link>
		<comments>http://www.shaunabram.com/18/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 21:45:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=18</guid>
		<description><![CDATA[My latest reading material is POJOs in Action &#8211; a good book about developing Enterprise Applications using Lightweight Frameworks such as Spring, Hibernate and JDO. It basically advocates an alternative approach to using heavyweight containers such as EJBs (although they seem have improved a lot since the release of EJB3). I was also able to [...]]]></description>
			<content:encoded><![CDATA[<p>My latest reading material is <a href="http://www.amazon.com/POJOs-Action-Developing-Applications-Lightweight/dp/1932394583">POJOs in Action</a> &#8211; a good book about developing Enterprise Applications using Lightweight Frameworks such as <a href="http://www.springframework.org">Spring</a>, <a href="http://www.hibernate.org">Hibernate</a> and <a href="http://java.sun.com/jdo">JDO</a>. It basically advocates an alternative approach to using heavyweight containers such as EJBs (although they seem have improved a lot since the release of EJB3).</p>
<p>I was also able to meet the author, Chris Richardson, after attending my first <a href="http://www.shaunabram.com/wp-admin/San Francisco Java User Group">San Francisco Java User Group</a> meeting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JEE</title>
		<link>http://www.shaunabram.com/jee/</link>
		<comments>http://www.shaunabram.com/jee/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 21:05:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[jee]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=14</guid>
		<description><![CDATA[So what exactly is Java Enterprise Edition? Although I am a Sun Certified Enterprise Architect, and have worked with much of the J2EE family, I thought that with all the recent changes introduced in the latest version, JEE 5, it was worth writing a short article giving an overview of JEE to remind me of [...]]]></description>
			<content:encoded><![CDATA[<p>So what exactly is Java Enterprise Edition?</p>
<p>Although I am a Sun Certified Enterprise Architect, and have worked with much of the J2EE family, I thought that with all the recent changes introduced in the latest version, JEE 5, it was worth writing a short article giving an overview of JEE to remind me of where it all stands.</p>
<p>See <a title="JEE" href="http://www.shaunabram.com/?page_id=15">JEE</a>.</p>
<p>Update: I just saw <a href="http://www.theserverside.com/news/thread.tss?thread_id=50291">this posting</a> on TheServerSide related to the upcoming JEE 6 release&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/jee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effective Java</title>
		<link>http://www.shaunabram.com/effective-java/</link>
		<comments>http://www.shaunabram.com/effective-java/#comments</comments>
		<pubDate>Mon, 26 May 2008 23:11:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=12</guid>
		<description><![CDATA[Just finished reading Effective Java by Joshua Bloch. It is a great book that contains many nuggets of info, best practices and gotchas. Definitely the best Java book I have read in a while. Next up, I have started on another book that Bloch contributed to: Java Concurrency in Practice.]]></description>
			<content:encoded><![CDATA[<p>Just finished reading <a href="http://www.amazon.co.uk/Effective-Java-Joshua-Bloch/dp/0201310058">Effective Java</a> by Joshua Bloch.</p>
<p>It is a great book that contains many nuggets of info, best practices and gotchas. Definitely the best Java book I have read in a while.</p>
<p>Next up, I have started on another book that Bloch contributed to: <a href="http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601">Java Concurrency in Practice</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/effective-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s new in Java 6?</title>
		<link>http://www.shaunabram.com/whats-new-in-java-6/</link>
		<comments>http://www.shaunabram.com/whats-new-in-java-6/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 21:35:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=8</guid>
		<description><![CDATA[Although it&#8217;s been around for a while, I&#8217;m still trying to get acquainted with version 6 of Java SE. It has many neat new features, such as integrated scripting, enhanced JDBC features and better Web service support. See Java 6 for some more details on it&#8217;s offerings. Also, even if you&#8217;re not interested in the [...]]]></description>
			<content:encoded><![CDATA[<p>Although it&#8217;s been around for a while, I&#8217;m still trying to get acquainted with version 6 of Java SE.</p>
<p>It has many neat new features, such as integrated scripting, enhanced JDBC features and better Web service support. See <a title="Java 6" href="http://www.shaunabram.com/?page_id=4">Java 6</a> for some more details on it&#8217;s offerings.</p>
<p>Also, even if you&#8217;re not interested in the new API and functionality, you might to consider just using it&#8217;s JRE as Java 6 is reported to be significantly faster. According to Sun, &#8220;existing applications will run faster than ever before on the new Java SE 6 release&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/whats-new-in-java-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
