I have a very basic JSF XHMTL page with the following content
<!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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Pregled oglasa</title>
</h:head>
<h:body>
<h:outputText value="#{oglasBean.naziv}" />
<br />
<br />
<h:outputText value="#{oglasBean.imeAutora}" />
<br />
<h:outputText value="#{oglasBean.prezimeAutora}" />
<br />
</h:body>
</html>
Here's the piece of code that sets up these variables:
public String pregledOglasa() {
Map<String, String> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
int idOglasa = Integer.parseInt(reqMap.get("oglas_id"));
for (Oglas oglas : aktivniOglasi) {
if (oglas.getIdOglasa() == idOglasa) {
this.setIdOglasa(idOglasa);
this.setNaziv(oglas.getNaziv());
this.setTekstOglasa(oglas.getTekstOglasa());
this.setImeAutora(oglas.getImeAutora());
this.setPrezimeAutora(oglas.getPrezimeAutora());
this.setLokacijaDo(oglas.getLokacijaDo());
}
}
return "/korisnik/pregledOglasa?faces-redirect=true";
}
What happens here is that "oglasBean.naziv", once when you open the page, comes after "oglasBean.imeAutora" and "oglasBean.prezimeAutora". Inspecting the code revealed that, for some reason, "oglasBean.naziv" is wrapped in pre tag and shows up the last, i.e. after "oglasBean.imeAutora" and "oglasBean.prezimeAutora":
In example given, "title 2" is meant to be above "John" and "Johnson".
Googling for this does't show anything similar, so it seems I am stuck here with a weird problem.
Even if I change "#{oglasBean.naziv}"
to "#{oglasBean.imeAutora}"
the problem remains the same, like JSF just takes whatever is first on the page and wrappes it in pre.