The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Blog Archive for mriem during August 2007

In order for the JSF component to work it needs to register itself to the JSF runtime. The configuration to do so is described below. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> <faces-config> <component> <component-...
The JSF component needs to be able to render, so you have to either deliver the renderer inline with the component or write a separate renderer. The code below describes the separate renderer. package com.manorrock.jsf.sunspot.temperature; import java.io.DataInputStream; import java.io.IOException; import java.io.PrintStream; import java.net.InetAddress; import java.net.InetSocketAddress;...
Getting the JSP part working requires a taglibrary. And its implementation. The code below describes that implementation. package com.manorrock.jsf.sunspot.temperature; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; import javax.faces.webapp.UIComponentTag; /** * A temperature tag for the SunSPOT. * * @author Manfred...
The code below is the component part for the Temperature JSF library. package com.manorrock.jsf.sunspot.temperature; import javax.faces.component.UIComponentBase; /** * A JSF SunSPOT temperature component. * * @author Manfred Riem (mriem@manorrock.org) */ public class TemperatureComponent extends UIComponentBase { /** * Stores the family. */ private static String FAMILY...
OK, native queries in JPA. Not really well documented. Of course I understand that we really should not be doing that, but hey there are times where it is just plain easier. The following code snippet goes after an Oracle sequence and gets the value. EntityManager em = this.getEntityManager(); Query query = em.createNativeQuery("SELECT BLOG_ITEM_SEQ.nextval FROM DUAL"); Vector blogItemRow = (...
The following web page shows you how easy it is once the JSF component has been written to access the SunSPOT and get the temperature out of it using JSF. <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@taglib prefix="temperature" uri="http://www.manorrock....
The following code snippet is the host application that I use to receive requests on a socket and I dispatch them into the SPOT realm. package com.manorrock.sunspot.temperature; import com.sun.spot.io.j2me.radiogram.RadiogramConnection; import com.sun.spot.peripheral.Spot; import com.sun.spot.util.IEEEAddress; import com.sun.spot.util.Utils; import java.io.BufferedReader; import java.io....
The following Java code is an implementation of a SunSPOT that upon receiving a request sends the temperature to the requestor. package com.manorrock.sunspot.temperature; import com.sun.spot.io.j2me.radiogram.RadiogramConnection; import com.sun.spot.peripheral.Spot; import com.sun.spot.sensorboard.EDemoBoard; import com.sun.spot.sensorboard.peripheral.ITriColorLED; import com.sun.spot.util....