开发者

How to Render FACEBOOK like button for each one of my records jsf java

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<h:outputText value="#{bean.fbC开发者_Go百科omponent}" />

col fbComponent (VARCHAR) & Getter and Setter in Class Bean for required component

The problem is that records in the db are being stored between (quotes?)'....'. Is there a way to store addresses or this kind of code on mysql rather than using '....'?

@Column(name = "fbComponent")
private String fbComponent;

//delete first and last char (')
public String getFBComponent() {
    StringBuilder fb = new StringBuilder(fbComponent);
    fb.deleteCharAt(0);
    fb.deleteCharAt(fb.length()-1);
    return fb.toString();
}
//delete first and last char (')
public void setFBComponent(String fbComponent) {
    StringBuilder fb = new StringBuilder(fbComponent);
    fb.deleteCharAt(0);
    fb.deleteCharAt(fb.length()-1);
    this.fbComponent = fb.toString();
}

Output:

&lt;fb:like href=&quot;http://www.faceb......and goes on

Thank you very much


h:outputText escapes text by default. That means the escape flag is indicating that characters that are sensitive in HTML and XML markup must be escaped. This flag is set to true by default.

If I understood your question correctly, you only need to set escape to false.

Try:

<h:outputText value="#{bean.fbComponent}" escape="false"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜