我有一个使用漂亮面孔的问题。在修改完我的表格之前,我通过漂亮的面孔对链接“ contact.xhtml”进行了URL重写,现在我的控制台中出现了一条错误消息。
我不确定一定要了解Pretty Face的所有功能。
我在jsf中有一个模板,其中包含标题,正文和菜单。在菜单中,我使用漂亮的链接漂亮的链接在后端bean中有一个目标ID,而后备bean使带有lang的URL并将URL转发给我的contact.xhtml页面。
contact.xhtml页面具有一个表单,并且表单通过javaxmail向托管bean中的方法发送一个用于发送表单的方法。
但是在单击按钮后,我在控制台中有一个异常指针。
我搜索了但没有发现问题...我在另一页中也有另一种形式,它是相同的,但是他没有使用相同的ManagedBean方法
你能帮我吗?对不起,我的英语不好。
复制代码后,您会发现我的错误
有关信息,我不使用pretty-config.xml(它是空的),我在我的bean中使用@注释进行所有重定向,问什么是最佳选择?,我喜欢@它与inject,jpa相同。我认为注入参数更容易,不是吗?
非常感谢
header.xhtml
Col1 | Title1 | Title2
mr. MA. | mr. | MA.
mrs. MS. | mrs. | MS.
mr. | mr. | NULL
miss | miss | NULL
BA. | NULL | BA.
MA. | NULL | MA.
Backing Bean PageController.java
<li class="dropdown-full-color dropdown-quaternary"><pretty:link
mappingId="contactForm">
<f:param value="#{langSwitcher.language}"></f:param>
<h:outputText value="#{i18n['nav.top.menu.contact']}"
class="nav-link"></h:outputText>
</pretty:link></li>
页面contact.xhtml
@Named("pageController")
@SessionScoped
@URLMappings(mappings={
@URLMapping(id = "contactForm", pattern = "/#{pageController.lang}/contact-agence-immobiliere", viewId = "/contact.xhtml"),
@URLMapping(id = "pageController", pattern = "/#{pageController.lang}/listing/maison-appartement", viewId = "/properties.xhtml")
})
public class PageController implements Serializable {
private static final long serialVersionUID = 1L;
private String lang;
public PageController() {
super();
// TODO Auto-generated constructor stub
}
public String getLang() {
return lang;
}
public void setLang(String lang) {
this.lang = lang;
}
}
托管Bean ContactFormBean.java
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pretty="http://ocpsoft.com/prettyfaces"
template="/WEB-INF/template/template.xhtml">
<ui:define name="content">
<div class="body">
<!-- Include header menu -->
<ui:include src="WEB-INF/template/header.xhtml" />
<div role="main" class="main">
<section
class="page-header page-header-light page-header-more-padding">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6">
<h1>
<h:outputText value="#{i18n['form.title.h1.page']}"></h:outputText>
</h1>
</div>
<div class="col-lg-6">
<ul class="breadcrumb">
<li><a href="index.xhtml">Home</a></li>
<li class="active">Contact</li>
</ul>
</div>
</div>
</div>
</section>
<div class="container">
<div class="row">
<div class="col-lg-8">
<!-- SubTitle Contact -->
<h4 class="heading-primary mt-4">
<h:outputText value="#{i18n['form.title.send.message']}"></h:outputText>
</h4>
<!-- Text under subtitle Contact -->
<h:outputText value="#{i18n['form.subTitle.send.message']}"></h:outputText>
<!-- Begin Form Contact -->
<h:form id="contactForm">
<p:growl id="growl" sticky="false" showDetail="false"
life="15000" />
<div class="form-row">
<div class="form-group col-lg-6">
<p:outputLabel id="labelContactName" for="formContactName"
value="#{i18n['form.contact.name']}"></p:outputLabel>
<p:inputText id="formContactName" value="#{contactForm.name}"
maxlength="100" class="form-control" required="true"
requiredMessage="#{i18n['warning.form.name']}"></p:inputText>
</div>
<div class="form-group col-lg-6">
<p:outputLabel id="labelContactEmail" for="formContactEmail"
value="#{i18n['form.contact.email']}"></p:outputLabel>
<p:inputText id="formContactEmail"
value="#{contactForm.email}" maxlength="100"
class="form-control" required="true"
requiredMessage="#{i18n['warning.form.email']}"
validatorMessage="#{i18n['warning.form.error.format.email']}">
<f:validateRegex
pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
</p:inputText>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<p:outputLabel id="labelContactMessage"
for="formContactMessage"
value="#{i18n['form.contact.message']}"></p:outputLabel>
<p:inputTextarea maxlength="5000" rows="5"
value="#{contactForm.requestMessage}" class="form-control"
id="formContactMessage" required="true"
requiredMessage="#{i18n['warning.form.request']}"></p:inputTextarea>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<p:outputLabel for="PrivacyAcceptTerms"
value="#{i18n['form.contact.privacy.accept']}"></p:outputLabel>
<p:selectOneRadio id="PrivacyAcceptTerms"
value="#{contactForm.privacyAccordForm}" required="true"
requiredMessage="#{i18n['warning.form.privacyPolicy']}">
<f:selectItem itemLabel="#{i18n['radio.yes']}"
itemValue="#{i18n['radio.yes']}" />
<f:selectItem itemLabel="#{i18n['radio.no']}"
itemValue="#{i18n['radio.no']}" />
</p:selectOneRadio>
</div>
</div>
<p:captcha id="captcha" label="Captcha" secure="true" />
<div class="form-row">
<div class="form-group col">
<p:commandButton id="commandButtonFormContact"
value="#{i18n['btn.send.message']}"
class="btn btn-secondary mb-4" update="growl"
action="#{contactForm.contactFormSendMessage}"
icon="ui-icon-check">
</p:commandButton>
</div>
</div>
</h:form>
<!-- End Form Contact -->
<h:outputText id="TextFooterForm"
value="#{i18n['contact.contactPage.callToAction']}"
style="text-align:justify" escape="false"></h:outputText>
</div>
<!-- Begin contact information -->
<div class="col-lg-4">
<h4 class="heading-primary mt-4">
<h:outputText value="#{i18n['office.h4.contact.title']}"></h:outputText>
</h4>
<ul class="list list-icons mt-3">
<li><i class="icon-location-pin icons"></i> <h:outputText
value="#{config.officeAddress}"></h:outputText></li>
<li><i class="icon-envelope-open icons"></i> <h:outputText
value="#{config.officeEmail}"></h:outputText></li>
<li><i class="icon-call-out icons"></i> <h:outputText
value="#{config.officePhone}"></h:outputText></li>
<li><i class="icon-social-linkedin icons"></i> <h:outputLink
value="#{config.socialLinkedinLink}" target="_blank">Linkedin</h:outputLink>
</li>
<li><i class="icon-social-facebook icons"></i> <h:outputLink
value="#{config.socialFacebookLink}" target="_blank">Facebook</h:outputLink>
</li>
<li><i class="icon-social-instagram icons"></i> <h:outputLink
value="#{config.socialInstagram}" target="_blank">Instagram</h:outputLink>
</li>
<li><i class="icon-social-youtube icons"></i> <h:outputLink
value="#{config.socialYoutube}" target="_blank">Youtube</h:outputLink>
</li>
</ul>
<hr class="solid mt-5 mb-5"></hr>
<h4 class="heading-primary">
<h:outputText value="#{i18n['offce.h4.openHour']}"></h:outputText>
</h4>
<ul class="list list-icons mt-3">
<li><i class="fa fa-clock-o"></i> <h:outputText
value="#{i18n['offce.openHour.week']}"></h:outputText></li>
<li><i class="fa fa-clock-o"></i> <h:outputText
value="#{i18n['office.openHour.week-end.open']}"></h:outputText></li>
<li><i class="fa fa-clock-o"></i> <h:outputText
value="#{i18n['office.openHour.week-end.close']}"></h:outputText></li>
</ul>
</div>
<!-- End contact information -->
</div>
</div>
<!-- Google Maps - Go to the bottom of the page to change settings and map location. -->
<div id="googlemaps" class="google-map mt-5 mb-0"></div>
<p:gmap id="googlemaps"
center="#{config.mapOfficeLat},#{config.mapOfficeLong}" zoom="13"
type="HYBRID" style="width:100%"
model="#{mapGoogleMarkers.mapSingleEstate}" />
<ui:define name="footer">
</ui:define>
</div>
</div>
<!-- Load API for Google MAP -->
<h:outputText value="#{config.apiGoogleMap}" escape="false"></h:outputText>
</ui:define>
不是重写我所有输入的概率是空的吗?
我使用jsf和primeface以及getter和setter它是自动的,但我不会说漂亮的脸蛋:(
谢谢