0
我是jsf的新手。我有兩個xhtml頁面:test.xhtml和exciseDetails.xhtml。當我點擊test.xhtml頁面上的「ExciseDetails」按鈕時,它將通過使用primefaces的對話框框架將exciseDetails.xhtml作爲對話框打開。如何在jsf中設置對話框的自定義大小?
我已經這樣做了,但是當對話框打開時並不是所有的組件都顯示出來。要看到它們,我必須使用該對話框中的滾動條。
如何最大化對話框? exciseDetails.xhtml頁面的所有組件應該是可見而無需滾動..
下面一個是beanclass
package com.madhu.tests.pagecode;
import javax.faces.bean.ManagedBean;
import org.primefaces.context.RequestContext;
import com.madhu.tests.bean.Excisebean;
@ManagedBean(name="pc_excisePageCode")
public class ExcisePageCode {
Excisebean excisebean=new Excisebean();
public ExcisePageCode() {
// TODO Auto-generated constructor stub
}
public void exciseDialog() {
RequestContext.getCurrentInstance().openDialog("exciseDetails");
}
public Excisebean getExcisebean() {
return excisebean;
}
public void setExcisebean(Excisebean excisebean) {
this.excisebean = excisebean;
}
}
exciseDetails.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:panelGrid>
<p:row>
<p:column >
<p:outputLabel for="regtype" value="Registration Type"
style="display: block;"></p:outputLabel>
</p:column>
<p:column>
<h:selectOneMenu id="regtype"
value="#{pc_excisePageCode.excisebean.regtype}"
style="width:200px;">
<f:selectItem itemLabel="--Select--" itemValue="#{null}" />
<f:selectItem itemLabel="Dealer" itemValue="Dealer" />
<f:selectItem itemLabel="Manufacturer" itemValue="Manufacturer" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="eregno" value="Excise Registration (ECC) No."
style="display: block; " />
</p:column>
<p:column>
<p:inputText id="eregno"></p:inputText>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="eregdate" value="Registration Date"
style="display: block;" />
</p:column>
<p:column>
<p:inputMask id="eregdate" mask="99-99-9999" />
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<p:panelGrid>
<p:row>
<p:column>
</p:column>
<p:column style="width:150px;display:block; text-align:center">
<p:outputLabel value="Code"></p:outputLabel>
</p:column>
<p:column style="width:150px;display:block; text-align:center">
<p:outputLabel value="Name"></p:outputLabel>
</p:column>
<p:column style="width:150px;display:block; text-align:center">
<p:outputLabel value="Address"></p:outputLabel>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="Range" />
</p:column>
<p:column>
<p:inputText id="rangecode"></p:inputText>
</p:column>
<p:column>
<p:inputText id="rangename"></p:inputText>
</p:column>
<p:column>
<p:inputText id="rangeaddress"></p:inputText>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="Division " />
</p:column>
<p:column>
<p:inputText id="divisioncode"></p:inputText>
</p:column>
<p:column>
<p:inputText id="divisionname"></p:inputText>
</p:column>
<p:column>
<p:inputText id="divisionaddress"></p:inputText>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="Commissionerate" />
</p:column>
<p:column>
<p:inputText id="commissioncode"></p:inputText>
</p:column>
<p:column>
<p:inputText id="commissionname"></p:inputText>
</p:column>
<p:column>
<p:inputText id="commissionaddress"></p:inputText>
</p:column>
</p:row>
</p:panelGrid>
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</h:body>
</html>
test.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form id="testform">
<p:commandButton id="excisebutton" value="Excise Details"
actionListener="#{pc_excisePageCode.exciseDialog()}"/>
</h:form>
</h:body>
</html>
請注意,OP正在以編程方式生成對話框。所以你應該或許提到這些屬性如何傳遞給'openDialog'。 – mabi
謝謝你解決問題... :) – mady