小编Mah*_*leh的帖子

JSF1027:[null] JSF的ELResolvers未在JSP容器中注册

我在websphere 8.5上使用javax.faces-2.0.10.jar,我正在使用jboss-el-2.0.0.GA.jar,在我的web.xml中我有以下el配置:

<context-param>     
  <param-name>com.sun.faces.expressionFactory</param-name>
  <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
</context-param>
Run Code Online (Sandbox Code Playgroud)

在日志中我可以看到jsf已成功初始化但我也看到以下错误:

JSF1027: [null] The ELResolvers for JSF were not registered with the JSP container.
Run Code Online (Sandbox Code Playgroud)

classloader设置为parent last,我可以打开没有错误的jsp和xhtml页面,但是我在日志中不断收到上述错误,为什么会有任何想法?

web.xml el jsf-2 websphere-8

8
推荐指数
1
解决办法
4132
查看次数

在java中的子域之间共享Cookie?

问候所有我有一些存储在http://sub1.myserver.com的 cookie ,我希望能够在http://myserver.com上看到它们的 任何想法如何做到这一点?

java cookies java-ee

7
推荐指数
2
解决办法
1万
查看次数

使用JSF bean验证在一个字段上的多个验证器

我试图在一个字段进行多次验证

    @NotBlank(message = "{name.required}")
    @Max(value = 25, message = "{long.value}")
    public String name;
Run Code Online (Sandbox Code Playgroud)

JSF:

<h:inputText id="name" value="#{person.name}" size="20">
</h:inputText>
<h:message for="name" style="color:red" />
Run Code Online (Sandbox Code Playgroud)

但是当我将该字段留空时,它会显示两条错误消息.

任何想法如何处理这两种情况,独立验证空和最大长度.

jsf hibernate-validator bean-validation jsf-2

7
推荐指数
1
解决办法
1709
查看次数

如何在ICEfaces中覆盖默认文件上传h:消息

我使用ace:fileEntry组件上传文件,成功上传后,我得到的消息是:

'File Entry' uploaded successfully 'filename'.
Run Code Online (Sandbox Code Playgroud)

我想覆盖此消息并显示其他消息(某种解析上传文件的摘要),任何想法如何?

这是我的代码:

<h:form>
        <ace:fileEntry id="fileEntryComp"
               label="File Entry"
               relativePath="uploaded"
               fileEntryListener="#{mybean.uploadFile}"/> 



        <h:commandButton value="Upload Excel File" />
        <h:message for="fileEntryComp" />         

    </h:form>
Run Code Online (Sandbox Code Playgroud)

jsf icefaces jsf-2 icefaces-2

7
推荐指数
2
解决办法
3423
查看次数

JSF中的条件变量定义

我想根据条件更改变量值,所以我尝试了以下内容:

<h:head>

    <ui:param name="userCase" value="Insert" />

    <ui:fragment rendered="#{employee.employeesBulkInsert==false}">
       <ui:param name="userCase" value="Update" />
    </ui:fragment>

       <title>#{userCase} Employee </title>

</h:head>
Run Code Online (Sandbox Code Playgroud)

但它在更新的情况下不起作用,它显示一个空字符串,任何想法为什么?

我知道还有其他解决方案,比如在支持bean中定义变量,或者直接在title标签上创建条件ui片段,但我想知道为什么上面的不起作用,请指教,谢谢.

facelets jsf-2

7
推荐指数
1
解决办法
9843
查看次数

subscribeToPullNotifications未检测到收件箱中的新电子邮件

我正在尝试使用subscribeToPullNotifications检测收件箱中的新电子邮件,如下所示:

PullSubscription subscription = service.subscribeToPullNotifications(
                folder, 1, null, EventType.NewMail);

        GetEventsResults events = subscription.getEvents();
        System.out.println("####### EVENTS: "
                + events.getItemEvents().toString());
        for (ItemEvent itemEvent : events.getItemEvents()) {
            if (itemEvent.getEventType() == EventType.NewMail) {
                EmailMessage message = EmailMessage.bind(service,
                        itemEvent.getItemId());
                System.out.println("######## NEW EMAIL MESSAGE IS: "
                        + message.getSubject());
            }
        }
Run Code Online (Sandbox Code Playgroud)

events.getItemEvents()总是空的,即使我可以在收件箱中看到新的电子邮件.还有如何在应用程序运行时始终重复上述代码,以便每分钟检查一次新的电子邮件.

exchangewebservices ewsjavaapi

7
推荐指数
1
解决办法
741
查看次数

弹簧不能使用PowerMockRule

我想用Spring使用PowerMockRule,我的测试类如下:

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ WebContextTestExecutionListener.class,
        DependencyInjectionTestExecutionListener.class,
        DirtiesContextTestExecutionListener.class,
        TransactionalTestExecutionListener.class })
@ActiveProfiles("test")
@DirtiesContext
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {
        SpringConfig.class, SpringTestingConfig.class,
        SpringLocalContainerJPAConfig.class, CustomConfiguration.class })
@PrepareForTest({ FacesContext.class })
@PowerMockIgnore({ "javax.management.*", "javax.xml.parsers.*",
        "com.sun.org.apache.xerces.internal.jaxp.*", "ch.qos.logback.*",
        "org.slf4j.*" })
public class MyTestClass{

@Rule
public PowerMockRule rule = new PowerMockRule();

}
Run Code Online (Sandbox Code Playgroud)

我的罐子如下:

<powermock.version>1.5.1</powermock.version>
<dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope> 
            <version>1.9.5</version>
        </dependency>

        <dependency>
          <groupId>org.powermock</groupId>
          <artifactId>powermock-module-junit4</artifactId>
          <version>${powermock.version}</version>
          <scope>test</scope>
       </dependency>

       <dependency>
          <groupId>org.powermock</groupId>
          <artifactId>powermock-api-mockito</artifactId>
          <version>${powermock.version}</version>
          <scope>test</scope>
       </dependency>

       <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-rule</artifactId>
        <version>${powermock.version}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.powermock</groupId>
         <artifactId>powermock-classloading-xstream</artifactId>
         <version>${powermock.version}</version>
         <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-rule-agent</artifactId>
        <version>${powermock.version}</version>
        <scope>test</scope>
      </dependency> …
Run Code Online (Sandbox Code Playgroud)

java junit spring mockito powermock

7
推荐指数
1
解决办法
7491
查看次数

无法获得正确的当前伊斯兰日期

我正在使用joda时间在沙特阿拉伯获得当前的伊斯兰日期,如同他们的网站:

DateTime dtISO = new DateTime(2014, 1, 9, 0, 0, 0, 0);
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance());
Run Code Online (Sandbox Code Playgroud)

上面打印的日期少于实际日期,它打印今天是7但实际是8.请告知.

更新:

我甚至用时区尝试了如下:

DateTimeZone SAUDI_ARABIA = DateTimeZone.forID("Asia/Riyadh");
DateTime dtISO = new DateTime(2014, 1, 9, 0, 0, 0, 0);
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance(SAUDI_ARABIA));
Run Code Online (Sandbox Code Playgroud)

但它给出了相同的结果.

java jodatime

7
推荐指数
1
解决办法
1825
查看次数

com.sun.mail.smtp.SMTPSenderFailedException:550 5.7.1客户端无权作为此发件人发送

我正在尝试从应用程序电子邮件(交换服务器)发送电子邮件,并为用户显示,因为它是使用javamail另一封电子邮件发送的,我使用以下代码:

public void sendEmail(String from, String to, String subject, String emailBody) throws Exception {

        try {

            emailHostSMTPs = MessageProvider.getConfig("email.host.smtps");
            emailHostSMTP = MessageProvider.getConfig("email.host.smtp");
            emailProtocol = MessageProvider.getConfig("email.protocol");
            senderEmail = MessageProvider.getConfig("email.sender");
            senderPassword = MessageProvider.getConfig("email.password");
            senderUser = MessageProvider.getConfig("email.sender.user");
            MimeMessage msg = null;

            // BodyPart imgPart = new MimeBodyPart();
            MimeBodyPart mbp1 = null, mbp2 = null;
            MimeMultipart mp = new MimeMultipart();

            String html = "";

            Properties props = System.getProperties();

            props.put("mail.smtp.starttls.enable", "true");
            props.put("mail.transport.protocol", emailProtocol);
            props.put("mail.smtps.ssl.checkserveridentity", "false");
            props.put("mail.smtp.ssl.trust", "*");
            props.put("mail.smtp.starttls.enable", "true"); …
Run Code Online (Sandbox Code Playgroud)

java exchange-server smtp jakarta-mail

7
推荐指数
2
解决办法
1万
查看次数

当会话在 websphere 中失效时,Spring 视图范围不会被破坏

我正在使用Springboot 1.5.9.RELEASEJSF 2.2.20 (glassfish)Primefaces 8WebSphere 8.5.5.13上运行 ,并且我已经根据以下链接定义了自定义视图范围:

https://github.com/jneat/spring-jsf

public class ViewScope implements Scope, HttpSessionBindingListener {

private static final long serialVersionUID = 1L;

private static final Log logger = LogFactory.getLog(ViewScope.class);

private final WeakHashMap<HttpSession, Set<ViewScopeViewMapListener>> sessionToListeners = new WeakHashMap<>();

@Override
public Object get(String name, ObjectFactory objectFactory) {
    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    if (viewMap.containsKey(name)) {
        return viewMap.get(name);
    } else {
        synchronized (viewMap) {
            if (viewMap.containsKey(name)) {
                return viewMap.get(name);
            } else {
                logger.trace("Creating …
Run Code Online (Sandbox Code Playgroud)

websphere jsf spring view-scope spring-boot

7
推荐指数
1
解决办法
115
查看次数