我在Java EE 6应用程序服务器(GlassFish v3)中使用带有Facelets的JSF 2.0.我在web.xml中为异常配置了一个错误页面:
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error-all.xhtml</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)
这是/error-all.xhtml
测试页面:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
template="/resources/templates/decorator.xhtml">
<ui:define name="title">Title</ui:define>
<ui:define name="body">
<h1>Body</h1>
</ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
我实现了一个托管bean,当我点击我的一个commandLinks时,它会故意抛出RuntimeException.当发生这种情况时,会显示/error-all.xhtml页面的内容,但它不会通过Facelets获取进程,因此不会应用template ="/ resources/templates/decorator.xhtml".
使用谷歌浏览器,我只看到"标题"和"正文",结果没有布局.如果我要求Chrome检查这些元素,我会得到完整的源代码,其中包括ui:composition和ui:define标记,Chrome显然无法理解.这证实了我的理论,即Facelets页面没有被处理.
所以,我的问题是,如何解决这个问题?如何处理错误页面并返回HTML代码,该代码是模板与错误页面内容组合的结果?
我正在尝试做一些非常简单的事情:用C中的execvp调用中的参数填充char**.
这就是我在做的事情:
if(argc >=1)
{
*nargv = "--action";
while(argc--)
{
printf("nargv1 => %s \t argv1 => %s \n", *nargv, *argv);
*++nargv = *argv++;
printf("nargv2 => %s \t argv2 => %s \n", *nargv, *argv);
}
printf("nargv3 => %s \t argv3 => %s \n", *nargv, *argv);
*nargv++ = '\0';
printf("nargv4 => %s \t argv4 => %s \n", *nargv, *argv);
}
Run Code Online (Sandbox Code Playgroud)
输出给了我:
nargv1 => --action argv1 => backup
nargv2 => backup argv2 => --help
nargv1 => backup argv1 => --help
nargv2 => --help …
Run Code Online (Sandbox Code Playgroud) 我有4个文本框,只能取一个数字.问题是我必须为控件创建4个单独的验证器,并将它们的id与验证器相关联.是否可以只有一个asp.net正则表达式验证器并将所有控件与该验证器相关联?
任何人都可以为使用C#语言访问Active Directory的初学者提供一些教程吗?谢谢.
在JSP中,我有以下字段:
<stripes:text name="email"/>
Run Code Online (Sandbox Code Playgroud)
这个字段在我的动作bean(片段)中:
public class CreateClaim implements ActionBean {
private String email;
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public Resolution alc(){
email = "poodle";
return new ForwardResolution("aForward.jsp");
}
}
Run Code Online (Sandbox Code Playgroud)
在alc()方法中,我将email设置为null.但是当页面呈现时,电子邮件字段的值与最初输入的完全相同.有没有办法清除此字段并触发事件?
干杯
戴夫
在初始连接后与postgres交互时,是否可以更改用户正在使用的postgresql角色?
数据库将在Web应用程序中使用,我希望对具有连接池的表和模式使用数据库级规则.从阅读postgresql文档看来,如果我最初作为具有超级用户角色的用户连接,我可以切换角色,但我更愿意最初以具有最小权限的用户连接并根据需要进行切换.切换时必须指定用户的密码才行(实际上我更喜欢它).
我错过了什么?
更新:我已经尝试了两个SET ROLE
并且SET SESSION AUTHORIZATION
按照@Milen的建议但是如果用户不是超级用户,那么两个命令似乎都不起作用:
$ psql -U test
psql (8.4.4)
Type "help" for help.
test=> \du test
List of roles
Role name | Attributes | Member of
-----------+------------+----------------
test | | {connect_only}
test=> \du test2
List of roles
Role name | Attributes | Member of
-----------+------------+----------------
test2 | | {connect_only}
test=> set role test2;
ERROR: permission denied to set role "test2"
test=> \q
Run Code Online (Sandbox Code Playgroud) 我有一个相当标准的设置,一个从未保存的暂存器MOC(包含从Web下载的一堆对象)和另一个永久MOC持久化对象.当用户从scratchMOC中选择一个对象添加到她的库时,我想要1)从scratchMOC中删除对象并插入到permanentMOC中,或者2)将对象复制到permanentMOC中.该核心数据FAQ说,我可以复制的对象是这样的:
NSManagedObjectID *objectID = [managedObject objectID];
NSManagedObject *copy = [context2 objectWithID:objectID];
Run Code Online (Sandbox Code Playgroud)
(In this case, context2 would be permanentMOC.) However, when I do this, the copied object is faulted; the data is initially unresolved. When it does get resolved, later, all of the values are nil; none of the data (attributes or relationships) from the original managedObject are actually copied or referenced. Therefore I can't see any difference between using this objectWithID: method and just inserting an entirely new …
cocoa cocoa-touch core-data nsmanagedobject nsmanagedobjectcontext
I'm testing how difficult it is to use NHibernate with a domain that is completely unaware of it and isn't bent to accodomate any limitations.
On many examples I found on the web the domain being mapped is yet another example of an anemic domain, where objects don't go far from being simple data holders. Sure, this makes the mapping simple and all and it might appeal to data-centric persons/situations, but I don't like hearing the voices in my head …
我只是想在页面上居中一个div.它适用于chrome,但是div仍然在左边:
<html>
<head></head>
<body>
<div id="container" style="margin:0 auto; width:200px;">
test
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我读过的所有内容都说要将块元素居中,只需添加margin:0 auto
并指定宽度,所以我不知道为什么这不起作用.
我正在测试IE 7.0.5730
我想创建一个double向量的向量向量,并希望它已经有(32,32,16)个元素,而无需手动推回所有这些元素.在初始化期间有没有办法做到这一点?(我不在乎推送什么价值)
谢谢
我想要一个三维数组,第一维有32,第二维有32,第三维有16个元素