渲染commandLink存储在数据库中

时间:2017-12-05 20:49:15

标签: primefaces

我使用样式创建了一个Chat对象:

代码

String style =  "<div style='border:2px solid #25d366; width:25px;height:25px; border-radius: 5px; display: inline-block; margin-right: 20px;'><p:commandLink  action='#{viewEventStatusController.callServiceAgent('{id: " + qrCode + ", action: warehouse}', chat.id)}' update='@this' disabled='#{!chat.valid}' ><h:graphicImage url='/images/1_yes_icon.png' width='22' height='22'/></p:commandLink></div>"; 
getLogger().info("style before setting to the chatText Object: " + style);
chatText.setStyle(style);

我将对象插入数据库的地方。

使用这段代码,我正在渲染样式的内容,但是我将样式插入显示的数据库中。

xhtml代码

<p:outputPanel rendered="#{viewEventStatusController.eventStatus.objectId != chat.fromName}" > 
             <div style="background-color:white; ; width: 60%; height: 80px;border-radius: 10px; margin-left: 5%; margin-top: 30px;margin-bottom: 30px; padding-left: 20px; padding-top: 10px; margin-left: 5%;">
              <div id="header2">
                      <!--messageHeader2-->
                      <div id="messageHeader2" style="display: inline-block; color: gray; font-size: 12px;">
                        <h:outputText value="#{chat.messageTopic}" />
                     </div>
                     <!--time-->
                     <div id="timeWord" style= "display: inline-block; color: gray; font-size: 12px; margin-left: 73%;"> 
                      <h:outputText value="#{chat.lastWrite}" converter="DateTimeConverter">
                              <f:convertDateTime pattern="HH:mm" timeZone="#{localeController.timeZone}"/>
                      </h:outputText> Uhr
                    </div>
                </div>
                <h:outputText value="#{chat.msg}" style="float: left; padding-top: 10px;" />
                <div id="buttonContainer" style="margin-bottom: 10px; float: right; margin-top: 20px !important; padding-right: 100px;">
                 <!--The servericAgent decides which button we have here-->
                  <h:form id="chatHTMLForm" rendered="#{chat.style != null}">
                     #{chat.style}
                  </h:form>
                </div>
             </div>
  </p:outputPanel>

如何获得存储在xhtml中显示的数据库中的commandLink按钮?

我正在接受以下

<div style='border:2px solid #25d366; width:25px;height:25px;
 border-radius: 5px; display: inline-block; margin-right:
 20px;'><p:commandLink 
 action='#{viewEventStatusController.callServiceAgent('{id: Test 1,
 action: warehouse}', chat.id)}' update='@this'
 disabled='#{!chat.valid}' ><h:graphicImage
 url='/images/1_yes_icon.png' width='22'
 height='22'/></p:commandLink></div>

显示在xhtml中。

0 个答案:

没有答案