小编Jas*_*son的帖子

jsf给出方法未找到异常虽然它在那里,javax.el.MethodNotFoundException

尝试h:dataTable使用支持 bean显示 a 时出现以下异常

javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /table.xhtml @29,36 action="#{user.editEmployee}": Method not found: com.jason.jsf.User@1df228e.editEmployee()
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
javax.faces.component.UICommand.broadcast(UICommand.java:311)
javax.faces.component.UIData.broadcast(UIData.java:912)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Run Code Online (Sandbox Code Playgroud)

当我使用这些文件执行以下代码时,因为我是 jsf 的新手并且正在学习,请帮忙做一些解释

雇员.java

 package com.jason.jsf;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "employee", eager = true)
@SessionScoped
public class Employee {

    private String Id, name;
    private boolean canEdit;

    public Employee() {
        super();
        // TODO Auto-generated constructor stub
    }

    public Employee(String id, String name) {
        super();
        Id = id;
        this.name = name;
    }

    public String …
Run Code Online (Sandbox Code Playgroud)

jsf el jsf-2

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

java.lang.IllegalStateException:CDI API 在此环境中不可用。在 org.omnifaces.config.BeanManager

我米试图从它返回一个托管bean方法显示的图像byte[]<o:graphicImage>使用omn​​ifaces我部署omn​​ifaces 2.1在WEB_INF/lib 这里是我的代码

注册.java

public byte[] getImage() throws IOException{
return Utils.toByteArray(Faces.getResourceAsStream("/resources/images/loader.gif"));


        }
Run Code Online (Sandbox Code Playgroud)

主页.xhtml

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html 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:o="http://omnifaces.org/ui">
<h:head>
<h:outputStylesheet library="css" name="style.css"></h:outputStylesheet>
    <style>
.center {
    align: center;
}
</style>

</h:head>
<h:body>
    <h:form>
    <table style="float:right;margin-top:5px;">
        <tr><td><h:commandLink action="/user/second.xhtml" style="float:right;">Second page</h:commandLink></td>
        <td><h:commandLink action="#{login.logout}" style="float:right;">Logout</h:commandLink></td></tr>
</table>        
    </h:form>
    <h:form>
        <div style="margin: auto;">
            <h:messages globalOnly="true" infoStyle="display:none" styleClass="error" style="list-style-type:none;"/>
            <h:messages globalOnly="true"  errorStyle="display:none" styleClass="green" style="list-style-type:none;"/>
            <h4 align="center">Welcome to JSF #{login.username} Dude</h4>

            <h3 align="center">User Profile</h3> …
Run Code Online (Sandbox Code Playgroud)

java eclipse jsf tomcat omnifaces

0
推荐指数
1
解决办法
2688
查看次数

标签 统计

jsf ×2

eclipse ×1

el ×1

java ×1

jsf-2 ×1

omnifaces ×1

tomcat ×1