0
私はテーブルを作成しました。私はそれを編集するためにモーダルで各行の詳細を復習したいと思います。 私のXHTMLページは以下の通りです:クリックしたブートストラップテーブルの行の詳細を表示
<!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"
xmlns:p="http://primefaces.org/ui"
template="/pages/indexTemplate.xhtml">
\t <h:head>
\t <title>SLEAM Book | Consult a Facebooker</title>
<link rel="shortcut icon" type="image/x-icon" href="#{resource['icons/hki2.gif']}"/>
<style>
\t \t \t .ui-datatable thead th, .ui-datatable tbody td, .ui-datatable tfoot td {
\t \t border-style: none;
</style>
</h:head>
\t <h:body>
\t <ui:composition template="indexTemplate.xhtml">
\t \t \t <ui:define name = "content">
\t \t <h:form id="myForm">
\t \t <h:outputText value="Add a Publication" styleClass="text-primary"/>
\t \t <br/><br/>
\t \t \t <h:inputText value="#{userBean.publicationContent}" styleClass="form-control"/>
\t \t \t <br/>
\t \t \t <p:commandButton value="Post"
\t \t \t \t \t \t \t \t \t action="#{userBean.createPublication}"
\t \t \t \t \t \t \t \t \t styleClass="btn btn-primary"
\t \t \t \t \t \t \t \t \t id="btn" ajax="true"/>
\t \t \t \t \t <br/><br/><br/>
\t \t \t \t \t <div class="table-responsive">
\t \t \t \t \t <p:dataTable id="aa" var="car" value="#{userBean.lps}" tableStyleClass="table table-striped">
\t \t \t \t \t <f:facet name="header">
\t \t \t \t \t List Of Publications
\t \t \t \t \t </f:facet>
\t \t \t \t \t
\t \t \t \t \t <p:column headerText="Id">
\t \t \t \t \t <h:outputText value="#{car.id}" />
\t \t \t \t \t </p:column>
\t \t \t \t \t <p:column headerText="Title">
\t \t \t \t \t <h:outputText value="#{car.title}" />
\t \t \t \t \t </p:column>
\t \t \t \t \t <p:column style="width:32px;text-align: center">
\t \t \t \t \t \t <p:commandLink value="Edit" styleClass="btn btn-primary" onclick="$('#myModal').modal('show');" update=":myForm" immediate="true">
\t \t \t \t \t <f:setPropertyActionListener value="#{car}" target="#{userBean.selectedPublication}" />
\t \t \t \t \t </p:commandLink>
\t \t \t \t \t
\t \t \t \t \t \t \t \t <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true" data-keyboard="false" data-backdrop="static">
\t \t \t \t \t \t \t \t <div class="modal-dialog modal-sm">
\t \t \t \t \t \t \t \t <div class="modal-content">
\t \t \t \t \t \t \t \t <h:form id="myForm">
\t \t \t \t \t \t \t \t <div class="modal-header">
\t \t \t \t \t \t \t \t <h4 class="modal-title">Test Modal</h4>
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t \t <div class="modal-body">
\t \t \t \t \t \t \t \t \t <p:outputPanel id="carDetail" style="text-align:center;">
\t \t \t \t \t \t \t \t \t **
\t \t \t \t \t \t \t \t \t <h:outputText value="#{userBean.selectedPublication.id}"/>
\t \t \t \t \t \t \t \t \t **
\t \t \t \t \t \t \t \t </p:outputPanel>
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t \t <div class="modal-footer">
\t \t \t <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\t \t \t <button type="button" class="btn btn-primary">Save changes</button>
\t \t \t </div>
\t \t \t \t \t \t \t \t </h:form>
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t </p:column>
\t \t \t \t \t </p:dataTable>
\t \t \t \t \t </div> \t \t
\t \t \t \t </h:form>
\t </ui:define>
\t \t </ui:composition>
\t </h:body>
</html>
テーブルの行をクリックした後、モーダルが表示されますが、私の問題は私がクリックした行のIDを回復することができないということです。 この問題を解決するにはどうかありがたいですか、ありがとうございます。
ありがとうございました。 – Nerimen