CaptainMorgan
CaptainMorgan

Reputation: 1253

custom div attributes in JSF 1.2

I'm using JSF 1.2 and I would like the following div to be rendered, where the latitude and longitude are stored in the backing bean

<div id="divMap" latitude="123456789" longitude="123456789"></div>

How can this be done?

Upvotes: 0

Views: 80

Answers (1)

patstuart
patstuart

Reputation: 1988

Use the escape="false" parameter of <h:outputText>.

An example

In your JSF:

<h:outputText value="#{myBean.divMap}" escape="false" />


In your bean:

public class MyBean() {
    private String divMap;

    public MyBean() {
        ...

        //set the value of divMap here or in an actionListener. The below is just an example.
        divMap="<div id=\"divMap\" latitude=\""+latitude+"\" longitude=\""+longitude+"\"></div>";
    }

    public void setDivMap(String divMap) {
        ...
    }
    public String getDivMap() {
        ...
    }
}

Upvotes: 2

Related Questions