Note: I am running Glassfish 3 with Mojarra 2.0.0 (Beta1 b13) on Windows Vista with JDK 1.6.0_15. Identical results on Firefox, IE, Safari, and Chrome.
===================================
Quick Summary: whitespace is not preserved before h:outputText. The following outputs "blahblah", not "blah blah".
<h:outputText value="#{b.foo}"/> <h:outputText value="#{b.foo}"/>
===================================
Details: whitespace from the original .xhtml file is not preserved before h:outputText. This is true regardless of the type (String, int, double) of the property. You can download a sample Eclipse project that includes the code below and demonstrates the issue from
http://www.coreservlets.com/jsf2/
For example, here is a snippet of test.xhtml:
Foo <h:outputText value="#{myBean.field1}"/> <h:outputText value="#{myBean.field2}"/> <h:outputText value="#{myBean.field3}"/>
<hr/>
Foo
<h:outputText value="#{myBean.field1}"/>
<h:outputText value="#{myBean.field2}"/>
<h:outputText value="#{myBean.field3}"/>
<hr/>
Foo&nbsp;&nbsp;&nbsp;&nbsp;
<h:outputText value="#{myBean.field1}"/>&nbsp;&nbsp;&nbsp;&nbsp;
<h:outputText value="#{myBean.field2}"/>&nbsp;&nbsp;&nbsp;&nbsp;
<h:outputText value="#{myBean.field3}"/>
Here is the corresponding bean:
package myPackage;
import javax.faces.bean.*;
@ManagedBean(name = "myBean")
@RequestScoped
public class MyBean {
public String getField1() {
return ("field1");
}
public int getField2() {
return (123);
}
public double getField3() {
return (45.67);
}
}
In all three cases, the output is "Foofield112345.67", with no spaces.
Cheers-
- Marty (hall_at_coreservlets.com)
[Message sent by forum member 'martyhall' (martyhall)]
http://forums.java.net/jive/thread.jspa?messageID=361210