定义View Params之间有什么区别:
<f:metadata>
<f:viewParam name="id" value="#{someBean.id}"/>
</f:metadata>
Run Code Online (Sandbox Code Playgroud)
并在ManagedBean中定义属性,如下所示:
@ManagedProperty(value = "#{param.id}")
private Integer id;
Run Code Online (Sandbox Code Playgroud) 我如何转换的国际(如俄罗斯)字符串到\u
数字(Unicode数字),
如\u041e\u041a
为OK
?
我在recaptcha.net上使用mydomain.com注册了一个帐户.
虽然我正在开发我的localhost
工作正常,但每当我尝试从本地网络中的另一台机器打开页面时,它会显示"input error: invalid referer"
错误消息!
我没有使用recaptcha插件.
我需要将参数(POST)传递给@managedBean,我使用了这样的托管属性:
@ManagedProperty(value = "#{param.id}")
private int id;
Run Code Online (Sandbox Code Playgroud)
Bean的范围是ViewScope
我最终得到了这个错误:
无法创建托管bean收据.发现了以下问题: - 表达式#{param.id},request引用的对象的范围比引用的托管bean范围短
我能做什么?
arjan看看:
我的页面:Facelet Title
<form method="post" action="faces/index.xhtml">
<input name="id" value="4" />
<input type="submit" value="submit" />
</form>
<h:form>
<h:commandLink value="click" action="index">
<f:param id="id" name="id" value="20"/>
</h:commandLink>
</h:form>
Run Code Online (Sandbox Code Playgroud)
我已经将Facelet视图模板声明如下:
<ui:composition template="./templates/master.xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui">
<ui:define name="content">
<h:panelGroup rendered="#{!current.hasLoggedIn()}">
<h:panelGroup layout="block" styleClass="warningBox">
<h:outputText value="#{app.youHaveNotLoggedIn}"/>
<br/>
<h:link value="#{lbls.login}" outcome="login"/>
</h:panelGroup>
</h:panelGroup>
<h:panelGroup rendered="#{current.hasLoggedIn()}">
<p:panel>
<f:facet name="header">
<h:outputText value="#{lbls.requestWaggon}" />
</f:facet>
<h:form id="frmRequest">
<h:panelGrid columns="3" footerClass="buttons">
<h:outputText value="#{lbls.number}:"/>
<h:inputText id="number" label="#{lbls.number}" styleClass="ltr" value="#{requestWaggon.request.number}" readonly="true" />
<h:message for="number" infoClass="info" warnClass="warning" errorClass="error" fatalClass="fatal"/>
<h:outputText value="#{lbls.requestDate}:"/>
<h:panelGroup>
<h:inputText styleClass="date ltr" id="date" label="#{lbls.requestDate}" value="#{requestWaggon.request.date}" required="true">
<f:converter converterId="ir.khorasancustoms.DateConverter"/>
</h:inputText>
<input type="button" value="..." onclick="displayDatePicker('frmRequest:date', this);" class="datePicker"/>
</h:panelGroup>
<h:message for="date" infoClass="info" warnClass="warning" errorClass="error" fatalClass="fatal"/>
<h:outputText value="#{lbls.nameOfMaterialOwner}:"/>
<h:inputText …
Run Code Online (Sandbox Code Playgroud) 我在NetBeans中看到一个用于选择JSP
for a的功能Servlet
,结果XML web.xml
就是这样的:
<servlet>
<servlet-name>TestServlet</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
Run Code Online (Sandbox Code Playgroud)
这是什么意思?它的用途是什么?它是否像ASP .NET中的架构背后的代码?
关于Java EE Web应用程序将由完整的Java EE应用程序服务器提供服务,例如GlassFish,这是最好的ORM解决方案?EJB 3或Hibernate 3 为什么?
为了在输入对话框中有自定义按钮标题,我创建了以下代码:
String key = null;
JTextField txtKey = new JTextField();
int answerKey = JOptionPane.showOptionDialog(this, new Object[] {pleaseEnterTheKey, txtKey}, decryptionKey, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] {okCaption, cancelCaption}, okCaption);
if (answerKey == JOptionPane.OK_OPTION && txtKey.getText() != null) {
key = txtKey.getText();
}
Run Code Online (Sandbox Code Playgroud)
如何在显示对话框时将焦点(光标)移动到文本字段?
UPDATE
这对我不起作用,我的意思是文本字段没有焦点:操作系统:Fedora - Gnome
public class Test {
public static void main(String[] args) {
String key = null;
JTextField txtKey = new JTextField();
txtKey.addAncestorListener(new RequestFocusListener());
int answerKey = JOptionPane.showOptionDialog(null, new Object[]{"Please enter the key:", txtKey}, "Title", JOptionPane.OK_CANCEL_OPTION, …
Run Code Online (Sandbox Code Playgroud) 我已经定义了我支持的语言faces-config.xml
如下:
<locale-config>
<default-locale>fa</default-locale>
<supported-locale>fa</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
Run Code Online (Sandbox Code Playgroud)
如何访问受支持的区域设置ManagedBean
?例如,用相应的项填充列表.
是否可以将对象作为itemValue标记?
例如,我有一个类Foo:
public class Foo {
private int id;
private String name;
private Date date;
}
Run Code Online (Sandbox Code Playgroud)
而另一个班吧
public class Bar {
private Foo foos;
}
public class BarBean {
private Set<Foo> foos;
}
Run Code Online (Sandbox Code Playgroud)
现在在一个名为BarBean的Bean中,我需要有一个从用户那里得到当前Bar的Foo,如下所示:
<h:selectOneMenu value="#{barBean.bar.foo}" required="true">
<f:selectItems value="#{barBean.foos}" var="foo" itemLabel="#{foo.name}" itemValue="#{foo}" />
</h:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)
---------------编辑:
my converter:
package ir.khorasancustoms.g2g.converters;
import ir.khorasancustoms.g2g.persistance.CatalogValue;
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
@FacesConverter("ir.khorasancustoms.CatalogValueConverter")
public class CatalogValueConverter implements Converter { …
Run Code Online (Sandbox Code Playgroud)