<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>JavaGeek.org - taglib tag</title>
  <link>http://javageek.org/tags/taglib/</link>
  <description>For the love of Java</description>
  <language>en</language>
  <copyright>Guillermo Castro</copyright>
  <lastBuildDate>Fri, 12 Nov 2010 16:04:24 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>Add author icons to your weblog comments</title>
    <link>http://javageek.org/2006/07/06/add_author_icons_to_your_weblog_comments.html</link>
    
      
        <description>
          Good news, everyone! No, Futurama isn&#039;t on the air, yet. But &lt;span style=&#034;font-style: italic;&#034;&gt;soon&lt;/span&gt;. Anyway, I&#039;m still here, albeit a little busy. However, in one of those few late night things I do, I was able to finish up a little project. If you didn&#039;t know, there&#039;s a site that stores your icons and lets weblogs put icons on the comments, based on the author&#039;s email. &lt;a href=&#034;http://www.gravatar.com/&#034;&gt;Gravatar.com&lt;/a&gt; provides your site with icons for all the people who comment on your weblog. This works by locally (on your site) generating an MD5 hash of the comment author&#039;s email, and then creating an img tag with a source URL that points to gravatar.com and uses the hash to identify the author, and if the author has previously registered that email with gravatar, it will give back an 80x80 picture that was previously loaded by the author. The MD5 hash avoids the need for someone&#039;s email address to leave your site, which I think it&#039;s good.&lt;br /&gt;&lt;br /&gt;I found this concept very interesting, and when I looked at the &lt;a href=&#034;http://www.gravatar.com/implement.php&#034;&gt;implementation page&lt;/a&gt;, I found out there&#039;s very few java support, other than some code on how to create the MD5 and I realized this was a good opportunity to create a taglib. So here it is. &lt;a href=&#034;http://javageek.org/files/javatar-20060705.jar&#034;&gt;jAvatar&lt;/a&gt; is a tag library that lets you include a gravatar icon for each of the comments on your weblog. To use it, you just need to add the javatar.jar to your webapp, and the taglib to your comment page. Here&#039;s an example on how you can do it on your comments JSP page:&lt;br /&gt;&lt;br /&gt;
&lt;div class=&#034;codeSample&#034;&gt;&amp;lt;%@ page language=&amp;quot;java&amp;quot; pageEncoding=&amp;quot;UTF-8&amp;quot; contentType=&amp;quot;text/html; charset=UTF-8&amp;quot;%&amp;gt;&lt;br /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;lt;%@taglib uri=&amp;quot;http://javageek.org/files/taglib/javatar&amp;quot; prefix=&amp;quot;javatar&amp;quot;%&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;%&lt;br /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;String email = &amp;quot;some_email@somesite.com&amp;quot;;&lt;/span&gt;&lt;br /&gt;%&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;My JSP &#039;index.jsp&#039; starting page&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is a gravatar: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;lt;javatar:image mail=&amp;quot;&amp;lt;%= email %&amp;gt;&amp;quot; imgSize=&amp;quot;100&amp;quot; styleClass=&amp;quot;gravatar&amp;quot; rating=&amp;quot;R&amp;quot; defaultImgUrl=&amp;quot;http://mysite.com/img/defIcon.gif&amp;quot; borderColor=&amp;quot;F0F&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;br /&gt;Of course, the email should be the comment author&#039;s email, and the tag should be put in whatever loop you have for showing your comments. I hope you like it.
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2006/07/06/add_author_icons_to_your_weblog_comments.html&#034;
    dc:identifier=&#034;http://javageek.org/2006/07/06/add_author_icons_to_your_weblog_comments.html&#034;
    dc:title=&#034;Add author icons to your weblog comments&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1152197927699&amp;token=8698285715618790201&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Web</category>
    
    <comments>http://javageek.org/2006/07/06/add_author_icons_to_your_weblog_comments.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2006/07/06/add_author_icons_to_your_weblog_comments.html</guid>
    <pubDate>Thu, 06 Jul 2006 14:58:47 GMT</pubDate>
  </item>
  
  </channel>
</rss>

