Geekscrap posted what one needs to change to feel like home in [X|K|Ed]ubuntu, at least if we’re talking about the beautiful colors, Gentoo users like the most!
http://geekscrap.com/2010/01/gentooize-part-1-colorize-console/
or, if the site does not load, try it with the cached version
cache:http://geekscrap.com/2010/01/gentooize-part-1-colorize-console/
Current Quercus java_bean() method does not work in Glassfish v3, because Caucho are cooking their own soup with everything new of JavaEE6 (I don’t understand why they need to reinvent all of JavaEE6 like JSF, CDI, etc. for their own app-server… why don’t use something existing and build on top of it? Why don’t push your own projects further, like Quercus, Hessian, Burlap and co.? )
If you, like me, want to use managed beans from inside your php code, and find out, that jndi_lookup and java_bean() do not work (= return null every time), try this little method
count($beans) < 1
function my_java_bean($name)
{
$beanManager = quercus_get_servlet_context()->getAttribute("javax.enterprise.inject.spi.BeanManager");
$beans = $beanManager->getBeans($name);
if($beans == null || )
return null;
$object = $beanManager->getReference($beans[0], $beans[0]->getClass(), $beanManager->createCreationalContext($beans[0]));
return $object;
}
The Spring Security Facelets/JSF 2.0 Taglib got released in version 0.3.
CHANGES:
Fetch it from the Project Homepage
As I had serious problems with FileUpload and the existing “solutions”, mainly Tomahawk, MyFaces, RichFaces, PrimeFaces, etc. which are all not 100% ready for JSF 2.
I created a taglib based on the code of BalusC.
You can find the Taglib on Github
The source code is based on these two posts:
Simply check out the code with git
git clone http://github.com/domdorn/fileUploadServlet3JSF2.git
then install the taglib with
mvn clean compile install
and import it into your maven project like this
net.balusc
fileUploadServlet3JSF2
1.0-SNAPSHOT
You can then use the taglib in your Facelets files like this:
Upload.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:hh="http://balusc.net/jsf/html"
>
<h:head>
<title>FileUploadTest</title>
</h:head>
<body>
<h:form prependId=”false”>
<!–<h:form>–>
<h:messages globalOnly=”false” id=”messages”/>
<h:panelGrid columns=”3″>
<label for=”someText”>
SomeText:
</label>
<h:inputText id=”someText” value=”#{uploadBean.someText}” required=”true”>
<f:ajax event=”blur” render=”someText someTextMessage” execute=”@this”/>
</h:inputText> <h:message for=”someText” id=”someTextMessage”/>
<label for=”filenameText”>
Filename:
</label>
<h:inputText id=”filenameText” value=”#{uploadBean.filename}” required=”true”>
<!–<f:ajax event=”blur” render=”filenameText messages filenameTextMessages @this” execute=”@this” />–>
<f:ajax event=”blur” render=”filenameText filenameTextMessage” execute=”@this” />
</h:inputText>
<h:message for=”filenameText” id=”filenameTextMessage”/>
</h:panelGrid>
</h:form>
<h:form enctype=”multipart/form-data” prependId=”false”>
<h:panelGrid columns=”3″>
<h:outputLabel for=”uploadedFile” rendered=”#{empty uploadBean.file}”>
Input File:
</h:outputLabel>
<hh:inputFile id=”uploadedFile” value=”#{uploadBean.file}” rendered=”#{empty uploadBean.file}”>
<f:validator validatorId=”fileValidator”/>
</hh:inputFile>
<h:message for=”uploadedFile”/>
</h:panelGrid>
<h:commandButton value=”submit” action=”#{uploadBean.submit}” />
</h:form>
</body>
</html>
The bean:
package com.dominikdorn.simpleFileUpload.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;
import java.io.File;
@ViewScoped
@ManagedBean
public class UploadBean {
private File file;
private String filename;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
System.out.println(“binding filename”);
this.filename = filename;
}
public String submit()
{
System.out.println(“calling submit”);
if(file != null)
{
this.filename = file.getName();
}
System.out.println(“processed”);
// do what you want with the file
return “yeah”;
}
public UploadBean() {
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
private String someText;
public String getSomeText() {
return someText;
}
public void setSomeText(String someText) {
System.out.println(“binding someText”);
this.someText = someText;
}
}
Mikael Gueck has posted some tips for Spring to JavaEE6 migration.
Quite nice in my opinion, especially the one for JPA N+1 !
Thanks Mikael! And merry xmas everyone!
Andy Gibson has blogged about how to use Context & Dependency Injection ( CDI, the @Inject annotation ) with JSF 2.
Also take a look at the comments, there is some useful info there too!
The german SEO Marketing Blog has a contest for winning a 2 month license for the new Xovi SEO Tool. Maybe I’m lucky
As Jurgen Hoeller posted today, Spring 3.0 is final!
I will check it out as soon as possible
Especially the SEO guys will find this one interesting: Google seems to started its Twitter integration as can be seen here:
If you trying to migrate a legacy PHP application which still uses PEAR::DB to Quercus with PostgreSQL and JDBC-Connection Pools accessible through JNDI, this may come handy for you!
1. Create your Datasource e.g. in Glassfish v3’s admin console… I named mine jdbc/postgresDS
2. copy the file pgsqljndi.php to /usr/share/php/DB/pgsqljndi.php (or wherever you include your PEAR stuff from..)
3. change the database connection creation part of your script to this:
$db = & DB::connect("pgsqljndi://java:comp/env/jdbc/postgresDS");
if(DB::isError($db))
{
// error handling
}
4. remove stuff like this from your scripts
$db->query("SET NAMES 'utf-8'; ");
Your database connection with PEAR::DB, Quercus, PostgreSQL, JDBC + JNDI should work now!