有没有办法instanceof在EL 进行检查?
例如
<h:link rendered="#{model instanceof ClassA}">
#{errorMessage1}
</h:link>
<h:link rendered="#{model instanceof ClassB}">
#{errorMessage2}
</h:link>
Run Code Online (Sandbox Code Playgroud) 今天通过启动我的glassfish,我看到一条关于已过期的证书的错误消息...
有人可以帮助我说出我能做什么/必须做什么?
这里的消息是:
...
[exec]
[exec] [#|2013-08-15T08:57:42.106+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=39;_ThreadName=Thread-2;|Grizzly
Framework 1.9.50 started in: 16ms - bound to [0.0.0.0:1307 6]|#]
[exec]
[exec] [#|2013-08-15T08:57:42.262+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=1;_ThreadName=Thread-2;|GlassFish
Server Open Source Edition 3.1.2.2 (5) startup time : Felix (1'1
23ms), startup services(609ms), total(1'732ms)|#]
[exec]
[exec] [#|2013-08-15T08:57:42.309+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.ssl.security.com.sun.enterprise.security.ssl.impl|_ThreadID=40;_ThreadName=Thread-2;|SEC5054:
Certificate has expired: [
[exec] [
[exec] Version: V3
[exec] Subject: CN=GTE CyberTrust Root 5, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US
[exec] Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
[exec]
[exec] Key: Sun RSA public key, 2048 bits
[exec] modulus: 237418898293472616608124373663877543854434319738611148654904141538840503317458119685231168476255701465927369352097185652960533868421359855348631579831288127741629980536737464707822524076734022381468699944387
29551246768368782318393878374421033907597162218758024581735139682087126982809511479059100617027892880227587855877479432885604404402435662802390484099065871430585284534529627347717530352189612077130606642676951640071336717026459037 …Run Code Online (Sandbox Code Playgroud) 我需要模拟左连接效果而不使用"左连接"键.
我有两个表,A和B,都有id和name列.我想在两个表中选择所有dbid,其中A中的名称等于B中的名称.
我使用它来进行同步,所以在开始时B是空的(所以我将有一对来自A的id,其值为一,而来自B的id为null).后来我将有价值的夫妻 - 价值和价值 - 无效.
通常它会是:
SELECT A.id, B.id
FROM A left join B
ON A.name = B.name
Run Code Online (Sandbox Code Playgroud)
问题是我不能使用left join并想知道是否/如何做同样的事情.
我有一个具有以下结构的WAR文件:

在JSF托管bean BusinessObjectTypeListController位于commons-web-1.0.jar中/WEB-INF/lib和参考的BusinessObjectTypeListView.xhtml.当我运行我的Web应用程序并调用该视图时,出现以下错误:
javax.servlet.ServletException:/view/common/businessObjectTypeListView.xhtml @ 34,94 listener ="#{businessObjectTypeListController.selectData}":目标无法访问,标识符'businessObjectTypeListController'已解析为null
为什么找不到控制器类?它应该在classpath中,是吗?
我想知道当天的哪一天是当天,看着SimpleDateFormat类我认为"F"是我需要的.所以我写了一个小测试:
System.out.println(new SimpleDateFormat("F").format(new Date()));
Run Code Online (Sandbox Code Playgroud)
今天是星期三,我希望得到3作为输出.相反,我得到2.
由于英语不是我的母语,我是否错过理解格式的含义?
我想根据bean值设置一个ui:param,我想用c:if是个好主意.所以我在我的页面中输入以下代码:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:wai="http://www.id.ethz.ch/wai/jsf"
template="/view/listView.xhtml">
<c:if test="#{subscriptionListController.model.listViewName eq 'mySubscriptions'}">
<ui:param name="title" value="#{msg.subscriptionTitleMySubscriptions}"/>
</c:if>
<c:if test="#{subscriptionListController.model.listViewName eq 'paidSubscriptions'}">
<ui:param name="title" value="#{msg.subscriptionTitlePaidSubscriptions}"/>
</c:if>
<c:if test="#{subscriptionListController.model.listViewName eq 'allSubscriptions'}">
<ui:param name="title" value="#{msg.subscriptionTitleAllSubscriptions}"/>
</c:if>
....
Run Code Online (Sandbox Code Playgroud)
但参数未设置...
如果我打印出来的值,#{subscriptionListController.model.listViewName eq 'mySubscriptions'}我会在相应的情况下得到真值,而在其他两种情况下则为假.
一开始我只有两种可能性并用三元运算符解决了它:
<ui:param name="title" value="#{subscriptionListController.model.listViewName eq 'mySubscriptions' ? msg.subscriptionTitleMySubscriptions : msg.subscriptionTitlePaidSubscriptions}"/>
Run Code Online (Sandbox Code Playgroud)
它起作用了.但现在我有更多的可能性......
我究竟做错了什么?
我需要一个URL只能为某些已定义的用户访问.在URL中有一个查询参数,它是鉴别器.
URL可能是这样的:
https://my.my.com/my-app/view/myView.xhtml?myQueryParam=allUsers
Run Code Online (Sandbox Code Playgroud)
我在这样的apache配置中的经验是〜0和谷歌搜索我可以设置这个:
RewriteEngine on
RewriteCond %{QUERY_STRING} myQueryParam=allUsers
RewriteRule "/my-app/view/myView[.]xhtml.*" - [E=no_auth_required:1]
<LocationMatch "/my-app/view/myView[.]xhtml.*">
Require uniqueID user1ID user2ID
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)
之间xhtml也?可能会出现额外的字符串,因此.*.
这有效但问题是它也拒绝访问ex.到链接
https://my.my.com/my-app/view/myView.xhtml?myQueryParam=somethingElse
Run Code Online (Sandbox Code Playgroud)
它似乎没有打扰查询参数的值...
我错过了什么?
编辑:我忘了说我使用Apache 2.2.
我有一个对象列表,我想用定义的顺序对它进行排序.对于前者 我有一个带有字段的对象String color.我想在颜色字段上对我的列表进行排序,使它总是首先是白色而不是蓝色而不是其他所有(如果可能的话,alph.有序但不是必需的):
Before sorting: After sorting:
orange white
white blue
green yellow
brown orange
yellow black
black brown
... ...
Run Code Online (Sandbox Code Playgroud)
有这么简单的方法吗?
编辑:
我必须添加一个更复杂的...
如果可以有更多颜色具有相同的名称/基数怎么办?对于前者 whiteX,whiteY,whiteZ,blueA,blueB,......
所有的白人都必须比所有的黄色首先出现,而不是所有的黄色.用比较器解决这个问题仍有可能吗?(我无法想象......)
我有以下界面:
public interface Ranged
{
public Object getRangeStart();
public Object getRangeEnd();
public void setRangeStart(Object rangeStart);
public void setRangeEnd(Object rangeEnd);
}
Run Code Online (Sandbox Code Playgroud)
以及以下实施类:
public class DateRange implements Ranged, Serializable
{
private static final long serialVersionUID=SerialVersionUID.getSerialVersionUID();
public DateRange()
{
}
private Date dateFrom;
private Date dateTo;
public Object getRangeStart()
{
return (Date)dateFrom;
}
public Object getRangeEnd()
{
return (Date)dateTo;
}
public void setRangeStart( Object from )
{
this.dateFrom = (Date)from;
}
public void setRangeEnd( Object to )
{
this.dateTo = (Date)to;
}
} …Run Code Online (Sandbox Code Playgroud) 我的(网络)应用程序中有以下工作流程:
我的问题是索引文件后,它仍然被锁定,删除部分抛出异常.
这是我的索引文件的代码片段:
try
{
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
req.addFile(file, type);
req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
NamedList<Object> result = server.request(req);
Assert.assertEquals(0, ((NamedList<?>) result.get("responseHeader")).get("status"));
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
编辑:
我也尝试过这种方式,但结果相同......
ContentStream contentStream = null;
try
{
contentStream = new ContentStreamBase.FileStream(document);
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest(UPDATE_EXTRACT_REQUEST);
// req.addFile(document, context.getProperty(FTSConstants.CONTENT_TYPE_APPLICATION_PDF));
req.addContentStream(contentStream);
req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
NamedList<Object> result = server.request(req);
if (!((NamedList<?>) result.get("responseHeader")).get("status").equals(0))
{
throw new IDSystemException(LOG, "Document could not be indexed. Status returned: " +
((NamedList<?>) result.get("responseHeader")).get("status"));
}
}
catch (FileNotFoundException fnfe)
{
throw …Run Code Online (Sandbox Code Playgroud) java ×4
jsf-2 ×2
apache ×1
apache-tika ×1
arraylist ×1
el ×1
facelets ×1
glassfish-3 ×1
instanceof ×1
jar ×1
java-ee ×1
jsf ×1
list ×1
managed-bean ×1
primefaces ×1
regex ×1
security ×1
solr4 ×1
solrj ×1
sorting ×1
sql ×1