我会让自己很客观:
一个用户注册自己,在这个操作后register我想表示一些消息说恭喜!欢迎!,如果duplicated key在我的数据库中存在某些问题,那样的话或某些消息.
我已经知道如何用RichFaces显示一些消息,但我想保持简单,RichFaces用CSS搞砸了一点,所以我想暂时避免使用它.
所以这里是我的页面和我的托管bean:
<h:form id="form_user">
<h:panelGrid columns="3">
<h:outputLabel for="name" value="Name:" />
<h:inputText id="name" value="#{personc.personb.person.name}">
<f:ajax event="blur" listener="#{personValidate.name}" render="m_name" />
</h:inputText>
<h:message id="m_name" for="name" />
<!--other fields...-->
<h:commandButton value="Register" action="#{personc.register}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
</h:panelGrid>
</h:form>
Run Code Online (Sandbox Code Playgroud)
人控制器(遵循MVC结构):
@ManagedBean(name="personc")
@SessionScoped
public class PersonController implements Serializable {
private static final long serialVersionUID = 2000186666864113813L;
// attributes
@EJB PersonEAO personEAO;
private PersonBean personb;
public PersonController() {
personb = new PersonBean();
}
// methods
public String …Run Code Online (Sandbox Code Playgroud) 我是新手,所以我在这里PlayFramework阅读相关内容。但是,该链接适用于旧版本:2.1.1
@Test
public void authenticateSuccess() {
Result result = callAction(
controllers.routes.ref.Application.authenticate(),
fakeRequest().withFormUrlEncodedBody(ImmutableMap.of(
"email", "bob@example.com",
"password", "secret"))
);
assertEquals(302, status(result));
assertEquals("bob@example.com", session(result).get("email"));
}
Run Code Online (Sandbox Code Playgroud)
上面的代码在当前版本中会是什么样子2.5?
我有这个POJO映射到我的MySQL数据库:
@Entity
@Table(name = "participantespresentes", catalog = "tagit")
public class Participantespresentes implements java.io.Serializable {
private ParticipantespresentesId id;
private Evento evento;
private Usuario usuario;
private boolean status;
public Participantespresentes() {
}
public Participantespresentes(ParticipantespresentesId id, Evento evento, Usuario usuario, boolean status) {
this.id = id;
this.evento = evento;
this.usuario = usuario;
this.status = status;
}
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "idUsuario", column =
@Column(name = "idUsuario", nullable = false)),
@AttributeOverride(name = "idEvento", column =
@Column(name = "idEvento", nullable = false))})
public ParticipantespresentesId getId() …Run Code Online (Sandbox Code Playgroud) 我正在使用JSF 2和JPA 2(EclipseLink 2.3)开发一个项目.在JSF 2中,我了解到我们必须将模型与Controller分开,并将相同的东西分离到View(感谢BalusC).但是现在有了JPA生成的POJO,我想知道豆子,模型,它现在应该是pojos.
我的观点是我的.xhtml页面,用JSF 2.0开发,它将与我的控制器交互,然后在控制器中调用DAO的类,然后在我的数据库中运行.
这是正确的吗 ?我的意思是在MVC的概念?我想做正确的事,任何提示?
提前致谢.
我想上传一些要存储在Azure中的图像,我发现在Blob中有一个名为"存储"的东西,经过一些研究后,我可以在存储服务中创建我的帐户,并使用'Azure Storage Explorer'访问它.
1)我可以访问我的存储帐户的另一个软件?还是另一种方式呢?
2)'公共容器'和'公共blob'之间有什么区别?
3)我想创建子文件夹,我该怎么做?
4)我如何制作一张上传到名为"图像"的"公共博客"的图像,这样的图像image\azure.png是否可以从互联网上的任何人访问?
在S3(来自亚马逊)中,您可以说该对象是否是公共的,然后从某个URL访问它.这可能是Azure存储服务吗?
我知道有很多问题,但对我来说,了解这些事情以及如何使它们现在起作用似乎有点复杂.
我试图只显示按钮add下面的按钮和上传的图片,但是我在CSS中做的并不重要,生成的表richfaces总是一样的:
这是我的表格使用richfaces:
<ui:define name="content">
<h:form>
<h:panelGrid>
<rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp" ontyperejected="alert('Just JPG, GIF, PNG and BMP are allowed');" maxFilesQuantity="12" immediateUpload="true" >
<a4j:ajax event="uploadcomplete" execute="@none" render="info" />
</rich:fileUpload>
<h:panelGroup id="info">
<h:outputText value="Add picture" rendered="#{fileUploadBean.size==0}" />
<rich:dataGrid columns="4" value="#{fileUploadBean.files}" var="file" rowKeyVar="row">
<a4j:mediaOutput element="img" mimeType="image/jpeg" createContent="#{fileUploadBean.paint}" value="#{row}" style="width:100px; height:100px;" cacheable="false" />
</rich:dataGrid>
<br />
<a4j:commandButton action="#{fileUploadBean.clearUploadData}" render="info, upload" value="Clear Uploaded Data" rendered="#{fileUploadBean.size>0}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</ui:define>
Run Code Online (Sandbox Code Playgroud)
这是如何生成的:

我想要一些更简单的东西'因为在另一个时刻我会有一些jQuery slider插件.但我不能用这个表生成的消失richfaces.是的 …
我想禁用当前日期之前的日期<rich:calendar>.我已经用Google搜索过了,但到目前为止似乎都没有.
知道如何以简单的方式做到这一点吗?
到目前为止这是我的代码:
<rich:calendar id="since" popup="false" value="#{c.since}" datePattern="dd/MM/yyyy" firstWeekDay="1" showWeeksBar="false" showApplyButton="false" showFooter="false" >
<a4j:ajax event="change" execute="@this" render="_since"/>
</rich:calendar>
Run Code Online (Sandbox Code Playgroud) Vagrant在提供期间执行我的脚本root。但我想在配置期间以另一个用户的身份执行一些命令。这就是我现在正在做的事情:
su - devops -c "git clone git://github.com/sstephenson/rbenv.git .rbenv"
su - devops -c "echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> ~/.bash_profile"
su - devops -c "echo 'eval "$(rbenv init -)"' >> ~/.bash_profile"
su - devops -c "git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build"
su - devops -c "echo 'export PATH=\"$HOME/.rbenv/plugins/ruby-build/bin:$PATH\"' >> ~/.bash_profile"
su - devops -c "source ~/.bash_profile"
Run Code Online (Sandbox Code Playgroud)
但我想让它变得更好,像这样:
#become devops user here
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build …Run Code Online (Sandbox Code Playgroud) 我有几个Vagrantfile,每个都不同provider,因为Vagrant有一个限制,不允许同时使用相同的Vagrantfile. 所以,我分成两个或更多Vagrantfiles,但我的“主体”,我的供应脚本对两者都是相同的,唯一改变的是provider块。
例如:
local_nagios/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
set = YAML.load_file '../../../settings.yaml'
Vagrant.configure(2) do |nagios|
nagios.vm.provider :virtualbox do |provider, override|
override.vm.box = 'ubuntu/trusty64'
override.vm.hostname = 'nagios.company.com'
override.vm.synced_folder '.', '/vagrant', disabled:true
override.vm.network 'public_network', bridge:set['network_interface'], ip:set['dev_nagios_ip']
provider.memory = 4096
provider.cpus = 2
end
install = set['devops_home'] + '/vagrant/lib/install'
nagios.vm.provision 'shell', path: install + '/basic'
nagios.vm.provision 'shell', path: install + '/devops'
step = …Run Code Online (Sandbox Code Playgroud) 我有这个构成:
<!DOCTYPE html>
<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:ui="http://java.sun.com/jsf/facelets">
<h:panelGroup rendered="#{empty userc.userb.user.id}">
<h:panelGrid columns="2" >
<h:outputLink value="system/register.xhtml">Register</h:outputLink>
<h:outputLink value="system/login.xhtml">Login</h:outputLink>
</h:panelGrid>
</h:panelGroup>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
如果用户在Login 页面中单击是重定向到的system/login.xhtml,这是正确的,但如果用户Login再次单击,则会重定向到system/system/login.xhtml.我知道这个解决方案,很久以前BalusC帮助了我:
<base href="#{fn:replace(request.requestURL, fn:substring(request.requestURI, 1, fn:length(request.requestURI)), request.contextPath)}/" />
Run Code Online (Sandbox Code Playgroud)
它解决了我的问题,但是当我点击一些链接时,我有一些ManageBean实例化它的bean无效.
如何保持每个链接页面中的url路径并将会话保留在托管bean中?