2012

25 06 2009

I’ve always been scared of the ocean. Deep water. And everytime I think of the world coming to an end, I picture myself drowning. Cold, total darkness, feet not touching the ground… scares the $%#* out of me.

Anyway, I don’t really know what the fuss is all about 2012, but I found the trailer to the movie. And I hope I die first before the world explodes, coz I really, really do NOT wanna drown.





The XMLs

23 06 2009

Initially, WordPress gives a Hello World post upon creating a blog. I figured, since I’m a programmer, why not say Hello the Java Portlet way? But it’s not complete when u don’t have the configuration in the two XMLs needed; web.xml & portlet.xml.

web.xml

<?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">
     <web-app>
        <display-name>Hello World Portlet</display-name>
        <description>Basic Sample Portlet</description>
     </web-app>

portlet.xml

<?xml version="1.0" encoding="UTF-8"?>
   <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
    http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">

     <portlet>
        <description xml:lang="en">A Hello World Portlet</description>
        <portlet-name>HelloWorldPortlet</portlet-name>
        <display-name xml:lang="en">Hello World</display-name>
        <portlet-class>example.portlet.HelloWorldPortlet</portlet-class>
        <supports>
          <mime-type>text/html</mime-type>
          <portlet-mode>view</portlet-mode>
        </supports>
        <supported-locale>en</supported-locale>
        <portlet-info>
          <title>Hello World</title>
          <short-title>Hello</short-title>
          <keywords>portlet, hello, world</keywords>
        </portlet-info>
     </portlet>
   </portlet-app>

Compile the class, war it, plug it in, and you should have a simple, normally-used-for-testing Hello World portlet.





Hello World!

22 06 2009
package example;

import java.io.PrintWriter;
import java.io.IOException;

import javax.portlet.GenericPortlet;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;

public class HelloWorldPortlet extends GenericPortlet {

  public void doView(RenderRequest request, RenderResponse response)
    throws PortletException, IOException
  {
    PrintWriter out = response.getWriter();

    out.println("Hello World!");
  }
}