<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Alex's Adventures on the Infobahn - jsp</title><link href="https://www.bennee.com/~alex/" rel="alternate"></link><link href="https://www.bennee.com/~alex/blog/tag/jsp/feed" rel="self"></link><id>https://www.bennee.com/~alex/</id><updated>2008-07-10T20:02:00+01:00</updated><subtitle>the wanderings of a supposed digital native</subtitle><entry><title>Context, Attributes and JSP</title><link href="https://www.bennee.com/~alex/blog/2008/07/10/context-attributes-and-jsp/" rel="alternate"></link><published>2008-07-10T20:02:00+01:00</published><updated>2008-07-10T20:02:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2008-07-10:/~alex/blog/2008/07/10/context-attributes-and-jsp/</id><summary type="html">&lt;p&gt;One thing that is rapidly becoming clear is a lot of different concepts get mixed together when you start playing with JSP. On the face of it it's a simple model, your JSP code get built into a Java class (of type servlet) which is a combination on normal Java …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One thing that is rapidly becoming clear is a lot of different concepts get mixed together when you start playing with JSP. On the face of it it's a simple model, your JSP code get built into a Java class (of type servlet) which is a combination on normal Java code and JSP mark up which gets converted into Java when the page is loaded. At any point in your HTML you can escape back into Java code, do calculations, execute loops, generally compute things. However that approach can get very messy because you end up spreading logic all through your presentational HTML. This is why using an &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;MVC&lt;/a&gt; pattern is so encouraged. Put all your logic and complex code at the top of the file and then display page expanding the odd attribute here and there.&lt;/p&gt;
&lt;p&gt;However I don't think I've fully grasped whats going on behind the scenes. It doesn't help with &lt;a class="reference external" href="http://jetty.mortbay.com/jetty-6/"&gt;Jetty&lt;/a&gt; I can't find where the intermediate Java source code is generated. Trying to understand whats going on when I'm not familiar with the cryptic backtraces has been frustrating to say the least.&lt;/p&gt;
&lt;p&gt;Now I'm a little confused as to what exactly happens with the ${var} notation in terms of the java code generated. My earlier &lt;a class="reference external" href="http://www.bennee.com/~alex/news.php?wl_mode=more&amp;amp;wl_eid=1070"&gt;code&lt;/a&gt; has mutated to a list with a custom class. Hence I have had to generate the following:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;&amp;lt;c:forEach &lt;span class="pre"&gt;var=&amp;quot;entry&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;items=&amp;quot;${model.jvmMemInfo}&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;varStatus=&amp;quot;status&amp;quot;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This is complex, I'm not sure how you can use ${} syntax on&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // arbitrary objects to expose the values, hence this bit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // of inline java. I'm open to elucidation on how you would do so&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NameValuePair data = (NameValuePair) &lt;span class="pre"&gt;pageContext.getAttribute(&amp;quot;entry&amp;quot;);&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%= data.name %&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%= data.value %&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/c:forEach&amp;gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;However there are &lt;a class="reference external" href="http://www.google.com/codesearch?hl=en&amp;amp;q=show:TrTtpLmB-cE:ZBsQHHkeTcM:TrTtpLmB-cE&amp;amp;sa=N&amp;amp;ct=rd&amp;amp;cs_p=http://dddjedi.googlecode.com/svn&amp;amp;cs_f=trunk/buyingbook/web/list.jsp&amp;amp;start=1"&gt;examples on the net&lt;/a&gt; showing arbitrary classes exposing their contents with this simple ${data.name} type syntax. I just couldn't get it to work. My NameValuePair class isn't much different from their &lt;a class="reference external" href="http://www.google.com/codesearch?hl=en&amp;amp;q=BookOrderData+show:D4EVt5aRC54:b7tWwGGm4c8:D4EVt5aRC54&amp;amp;sa=N&amp;amp;cd=1&amp;amp;ct=rc&amp;amp;cs_p=http://dddjedi.googlecode.com/svn&amp;amp;cs_f=trunk/buyingbook/test/model/BookOrderData.java"&gt;one&lt;/a&gt;. I suspect this would be a lot easier to work out if I could see the generated applet.&lt;/p&gt;
&lt;p&gt;Any Java web monkeys got experience with Jetty or can tell me what piece of obviousness I have missed?&lt;/p&gt;
</content><category term="geek"></category><category term="development"></category><category term="java"></category><category term="jsp"></category></entry><entry><title>JSP tags</title><link href="https://www.bennee.com/~alex/blog/2008/07/08/jsp-tags/" rel="alternate"></link><published>2008-07-08T14:56:00+01:00</published><updated>2008-07-08T14:56:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2008-07-08:/~alex/blog/2008/07/08/jsp-tags/</id><summary type="html">&lt;p&gt;Arrggh. I've just wasted the best part of half a day scratching my head as to why I was unable to iterate through a Java HashMap in a JSP page:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;&amp;lt;c:forEach &lt;span class="pre"&gt;var=&amp;quot;entry&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;items=&amp;quot;${model.jvmInfo}&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;varStatus=&amp;quot;status&amp;quot;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ${entry.key}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ${entry.value}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/c …&lt;/tt&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;Arrggh. I've just wasted the best part of half a day scratching my head as to why I was unable to iterate through a Java HashMap in a JSP page:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;&amp;lt;c:forEach &lt;span class="pre"&gt;var=&amp;quot;entry&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;items=&amp;quot;${model.jvmInfo}&amp;quot;&lt;/span&gt; &lt;span class="pre"&gt;varStatus=&amp;quot;status&amp;quot;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ${entry.key}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ${entry.value}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/c:forEach&amp;gt;&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;It would of been immediately clear had I looked at the resulting HTML the page was echoing. Note to self, always check you have explicitly included the &lt;a class="reference external" href="http://en.wikipedia.org/wiki/JavaServer_Pages_Standard_Tag_Library"&gt;taglib&lt;/a&gt; you are planning to use.&lt;/p&gt;
</content><category term="geek"></category><category term="development"></category><category term="java"></category><category term="jsp"></category></entry><entry><title>Bifurcated Weekend</title><link href="https://www.bennee.com/~alex/blog/2008/06/09/bifurcated-weekend/" rel="alternate"></link><published>2008-06-09T12:46:00+01:00</published><updated>2008-06-09T12:46:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2008-06-09:/~alex/blog/2008/06/09/bifurcated-weekend/</id><summary type="html">&lt;p&gt;The weekend was one of two halves, one half LRP and the other half drinking bubbly in gardens.&lt;/p&gt;
&lt;p&gt;I worked late on Thursday to get everything I needed out of the door for our &amp;quot;alpha&amp;quot; release so I could take Friday off. This included a crash course in &lt;a class="reference external" href="http://en.wikipedia.org/wiki/JavaServer_Pages"&gt;Java Server …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;The weekend was one of two halves, one half LRP and the other half drinking bubbly in gardens.&lt;/p&gt;
&lt;p&gt;I worked late on Thursday to get everything I needed out of the door for our &amp;quot;alpha&amp;quot; release so I could take Friday off. This included a crash course in &lt;a class="reference external" href="http://en.wikipedia.org/wiki/JavaServer_Pages"&gt;Java Server Pages&lt;/a&gt; so I could make some changes to &lt;a class="reference external" href="http://www.opennms.org/index.php/Main_Page"&gt;OpenNMS&lt;/a&gt;'s web pages to link to our own graphs and data. I can see why JSP is popular in the enterprise. The ability to tightly bind with your Java model and create web-apps can be pretty useful. However the development cycle is very slow. I have to edit the &amp;quot;installed&amp;quot; files while hitting re-load to develop the feature and then copy and paste the code across to the &amp;quot;repository&amp;quot; version, re-build and make sure I didn't screw up. There has to be a better way of doing this that doesn't involve custom build scripts to hack links about. Perhaps it will make more sense once I've read up a little bit more on the technology.&lt;/p&gt;
&lt;p&gt;We spent the first half of Friday unpacking the rest of the boxes from the move. This mainly involved a vast quantity of LRP kit. While sorting through we created about 3 bags of Freecycle LRP kit (of which about 1/3rd turned out to be Bacony's) which we hauled over to &lt;a class="reference external" href="http://www.profounddecisions.co.uk/"&gt;Maelstrom&lt;/a&gt; to find new homes. By the time we left on Saturday afternoon it seemed most of it had gone to a better place.&lt;/p&gt;
&lt;p&gt;The rest of Friday and Saturday day was spent actually playing which in my case proved to be quite fulfilling. Kita managed to get herself poisoned (again) so having a resident Alchemist around proved to be useful. I'm even spreading out my skills into a bit of surgery just so I'm not 100% potions.&lt;/p&gt;
&lt;p&gt;Saturday evening we headed over to a friend of Fliss' for her 30th birthday bash (and engagement celebration). Despite some issues with navigation we made it to the house in one piece. Much bubbly was consumed and we even played a game or two of &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Croquet"&gt;Croquet&lt;/a&gt; which is actually quite a vicious game when played tactically. I didn't stay up that late still being tired from the inevitable early start on Saturday morning that camping entails.&lt;/p&gt;
&lt;p&gt;Sunday was a more relaxed newspapers and lunch affair where I got to improve my knowledge of Fliss' social network by remembering more names and faces and the inter-relationships of people. I was firmly in the HABs category of people there which was no bad thing in itself. We also met a few people based in Cambridge so we can increase the social network at home now :-)&lt;/p&gt;
</content><category term="general"></category><category term="jsp"></category><category term="lrp"></category></entry></feed>