我使用来自primefaces的谷歌地图工具.我希望我的用户能够在地图上只放置一个标记.坐标值应存储在托管bean变量中.
我怎样才能做到这一点?看看到目前为止我做了什么:
我创建了地图:
<f:view contentType="text/html">
<p:gmap id="gmap" center="36.890257,30.707417" zoom="13" type="HYBRID"
style="width:600px;height:400px"
model="#{mapBean.emptyModel}"
onPointClick="handlePointClick(event);"
widgetVar="map" /> </f:view>
<p:dialog widgetVar="dlg" effect="FADE" effectDuration="0.5" close="false" fixedCenter="true">
<h:form prependId="false">
<h:panelGrid columns="2">
<h:outputLabel for="title" value="Title:" />
<p:inputText id="title" value="#{mapBean.title}" />
<f:facet name="footer">
<p:commandButton value="Add"
actionListener="#{mapBean.addMarker}"
update="messages"
oncomplete="markerAddComplete()"/>
<p:commandButton value="Cancel" onclick="return cancel()"/>
</f:facet>
</h:panelGrid>
<h:inputHidden id="lat" value="#{newOfferSupportController.mapLocationX}" />
<h:inputHidden id="lng" value="#{newOfferSupportController.mapLocationY}" />
</h:form>
</p:dialog>
<script type="text/javascript">
var currentMarker = null;
function handlePointClick(event) {
if(currentMarker == null) {
document.getElementById('lat').value = event.latLng.lat();
document.getElementById('lng').value = event.latLng.lng();
currentMarker = …Run Code Online (Sandbox Code Playgroud) 我正在填充<p:selectOneMenu/>数据库,如下所示.
<p:selectOneMenu id="cmbCountry"
value="#{bean.country}"
required="true"
converter="#{countryConverter}">
<f:selectItem itemLabel="Select" itemValue="#{null}"/>
<f:selectItems var="country"
value="#{bean.countries}"
itemLabel="#{country.countryName}"
itemValue="#{country}"/>
<p:ajax update="anotherMenu" listener=/>
</p:selectOneMenu>
<p:message for="cmbCountry"/>
Run Code Online (Sandbox Code Playgroud)
加载此页面时,默认选择的选项是,
<f:selectItem itemLabel="Select" itemValue="#{null}"/>
Run Code Online (Sandbox Code Playgroud)
转换器:
@ManagedBean
@ApplicationScoped
public final class CountryConverter implements Converter {
@EJB
private final Service service = null;
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
try {
//Returns the item label of <f:selectItem>
System.out.println("value = " + value);
if (!StringUtils.isNotBlank(value)) {
return null;
} // Makes no difference, if removed.
long parsedValue …Run Code Online (Sandbox Code Playgroud) PrimeFaces文档中的以下摘录表明,标题中描述的两个选择器之间存在差异:
.ui-widget, .ui-widget .ui-widget {
font-size: 90% !important;
}
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释第二个选择器(".ui-widget .ui-widget")的重要性吗?我理解它匹配类"ui-widget"的元素,它们本身就是同一个类的其他元素的子元素,但是第一个选择器已经没有选择它们了吗?
我正在尝试在DataTable中显示Hashmap,这是我正在尝试做的事情:我将有一些产品的选择菜单,数量的输入文本,添加产品的"ajaxified"添加按钮它的数量到地图,以及一个提交按钮,显示一个包含DataTable的摘要对话框,其中包含两列:Product Name和Quantitiy.我的Hashmap是
Map<Product,Integer> myMap = new HashMap<Product,Integer>();
Run Code Online (Sandbox Code Playgroud)
对于ajaxified按钮和所有这些第一步,他们正在为我工作,我已经设置了所有内容,并且地图正确地填充了剩下的所有数据.
提前致谢.
我是jsf的新手,想知道JSF,Rich-/Prime-/IceFaces之间的明显区别.
在JSF中,我们使用.jsp扩展名创建页面,并在后台bean中编写java代码.
但究竟所有"面孔"与jsf有何不同.
<ui:define name="content">
<f:view>
<h:form id="myForm" styleClass="form" >
<p:dataTable var="provider" id="ss" value="#{providerSelectBean.providerList}" rowKey="#{provider.license}"
selection="#{providerSelectBean.selectedProvider}" selectionMode="single">
<p:ajax listener="#{providerSelectBean.onRowSelect}"
update=":myForm:output"event="rowSelect"/>
<p:column sortBy="#{provider.license}" width="110" >
<f:facet name="header">
<h:outputText value="License#" />
</f:facet>
<h:outputText value="#{provider.license}" />
</p:column>
<p:column sortBy="#{provider.prgName}" width="110" >
<f:facet name="header">
<h:outputText value="Program Name" />
</f:facet>
<h:outputText value="#{provider.prgName}" />
</p:column>
</p:dataTable><br/>
<p:panelGrid id="output" >
<h:outputText value="License" />
<h:outputText value="#{provider.license}" />
</p:panelGrid>
</h:form>
</f:view>
</ui:define>
Run Code Online (Sandbox Code Playgroud)
这是我第一次使用JSF2.0和primefaces 3.4.1,并<p:ajax update给出了一个错误
javax.faces.FacesException: Cannot find component with identifier
":myForm:output" referenced from "myForm:ss"
Run Code Online (Sandbox Code Playgroud) 这是我的布局
<div id="mainPanel">
<div id="padding">
<h:outputText id="text" value="Personal Feed" rendered="#{Profile.renderComment}"/>
</div>
<div id="right">
<h:form>
<p:commandButton value="Update" actionListener="#{bean.toggleComment}" update="text" />
</h:form>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
当我单击链接时Update,它应该renderComment打开和关闭布尔值,它不会切换文本的显示Personal Feed.现在,如果我把一个表单周围h:outputText,并update在form相反,那么它的工作原理.这是为什么?
是否可以从Primefaces组件中删除所有样式?我的意思是,组件集很好,但必须手动覆盖每个组件的每一个小部分,以使组件样式适合我的应用程序的整体设计是不好的.我无法使用Firebug来查找它使用的类等等.
那么有没有办法删除它,只使用组件的功能,并提供自己的设计,而不是被迫使用默认....或其中一个"主题"?
我知道关于这个问题有很多问题,但对我来说没有任何问题.
我需要将PanelGrid对齐到中心(水平).
这是我的panelgrid
<p:panelGrid styleClass="panelGridCenter">
Run Code Online (Sandbox Code Playgroud)
和我的CSS:
.panelGridCenter td,.panelGridCenter tr {
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
它只是将内容对齐到中心,而不是panelGrid
嗨,我有一个带有一些函数的托管bean,基于该函数中的一些条件,我想调用一个对话框
托管bean函数如下
public String editStudent(){
setReadOnly(false);
setButton(true, true, true, false, true, true,true);
LockItem lItem;
if(selectStudent !=null){
lItem = (LockItem) services.getbyId("LockItem", condition);
if (lItem == null){
System.out.println("Student Avalibale for process :::");
studentRedirect();
return "studentEdit.jsf?faces-redirect=true";
} else {
//To show dialog from here
System.out.println("Student Not Avalibale : Locked By " + lItem.getLockedBy());
}
} else {
FacesMessage msg;
msg = new FacesMessage("Please select the record.");
FacesContext.getCurrentInstance().addMessage(null, msg);
return show("menu");
}
}
Run Code Online (Sandbox Code Playgroud)
是否有任何方法可以从这样的托管函数调用对话框
primefaces ×10
jsf ×8
css ×2
java ×2
jsf-2 ×2
converter ×1
google-maps ×1
hashmap ×1
jsf-2.2 ×1
jsp ×1
managed-bean ×1
modal-dialog ×1
panel ×1
richfaces ×1