JSP页面:<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><f:view>
<html>
<head>
<title></title>
</head>
<body background="../images/blue.jpg">
<h:form>
<f:loadBundle basename="com.data.analysis.resource.messages" var="messages"/>
<table align="center">
<thead >
<tr><td colsapn="2"><h:outputText value="#{messages.register_plant}"></h:outputText></td></tr></thead>
<tbody>
<tr>
<td>
<h:panelGrid columns="2">
<h:outputLabel for="userID" value="#{messages['user_name']}"></h:outputLabel>
<h:inputText id="userID" value="#{registerBean.user_ID}"></h:inputText>
<h:outputLabel for="userPassword" value="#{messages['user_password']}"></h:outputLabel>
<h:inputSecret id="userPassword" value="#{registerBean.user_Password1}"></h:inputSecret>
<h:outputLabel for="userAffirmpass" value="#{messages['user_affirmpass']}"></h:outputLabel>
<h:inputSecret id="userAffirmpass" value="#{registerBean.user_Password2}"></h:inputSecret>
<h:outputLabel for="sel_priv" value="#{messages['user_power']}"></h:outputLabel>
<h:selectOneMenu id="sel_priv" value="#{registerBean.user_Privilege}">
<f:selectItems value="#{registerBean.actionBean}"/>
</h:selectOneMenu>
<h:outputLabel for="sel_group" value="#{messages['user_coporation']}"></h:outputLabel>
<h:selectOneMenu id="sel_group" value="#{registerBean.user_Group}">
<f:selectItems value="#{registerBean.groupBean}"/>
</h:selectOneMenu>
<h:outputLabel for="sel_role" value="#{messages['user_role']}"></h:outputLabel>
<h:selectOneMenu id="sel_role" value="#{registerBean.user_Role}">
<f:selectItems value="#{registerBean.roleBean}"/>
</h:selectOneMenu>
<h:commandButton id="putOn" value="#{messages['register_puton']}" actionListener="#{registerBean.RegisterUser}"></h:commandButton>
</h:panelGrid>
</td>
</tr>
</tbody>
<tfoot>
<h:outputText value="#{messages.register_welcome}"></h:outputText>
</tfoot>
</table>
</h:form>
</body>
</html>
</f:view>managed bean :
package com.data.analysis.security.web;import java.util.ArrayList;
import java.util.List;import javax.faces.event.ActionEvent;import com.data.analysis.security.bo.ActionBean;
import com.data.analysis.security.bo.GroupBean;
import com.data.analysis.security.bo.RoleBean;
import com.data.analysis.security.bo.UserBean;import javax.faces.model.SelectItem;public class RegisterBackBean extends RegisterBackBaseBean
{
private String user_ID; //用户名
private String user_Password1; //密码
private String user_Password2;
private String user_Privilege; //所属组或者部门
private String user_Role; //角色 (高级管理员,,中级管理员,初级用户)
private String user_Group; //权限级别 (与角色对应)
private List<SelectItem> actionBean;
private List<SelectItem> groupBean;
private List<SelectItem> roleBean;
private List<ActionBean> list1;
private List<GroupBean> list2;
private List<RoleBean> list3;
........余下的没写出来
}
异常
2007-11-06 14:41:47,250 [http-8084-Processor22] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ElectronTax].[Faces Servlet] - Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /WebProject/GroupCreate.jsp][Class: javax.faces.component.html.HtmlForm,Id: _idJsp0][Class: javax.faces.component.html.HtmlPanelGrid,Id: _idJsp1][Class: javax.faces.component.html.HtmlInputText,Id: groupname]}
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><f:view>
<html>
<head>
<title></title>
</head>
<body background="../images/blue.jpg">
<h:form>
<f:loadBundle basename="com.data.analysis.resource.messages" var="messages"/>
<table align="center">
<thead >
<tr><td colsapn="2"><h:outputText value="#{messages.register_plant}"></h:outputText></td></tr></thead>
<tbody>
<tr>
<td>
<h:panelGrid columns="2">
<h:outputLabel for="userID" value="#{messages['user_name']}"></h:outputLabel>
<h:inputText id="userID" value="#{registerBean.user_ID}"></h:inputText>
<h:outputLabel for="userPassword" value="#{messages['user_password']}"></h:outputLabel>
<h:inputSecret id="userPassword" value="#{registerBean.user_Password1}"></h:inputSecret>
<h:outputLabel for="userAffirmpass" value="#{messages['user_affirmpass']}"></h:outputLabel>
<h:inputSecret id="userAffirmpass" value="#{registerBean.user_Password2}"></h:inputSecret>
<h:outputLabel for="sel_priv" value="#{messages['user_power']}"></h:outputLabel>
<h:selectOneMenu id="sel_priv" value="#{registerBean.user_Privilege}">
<f:selectItems value="#{registerBean.actionBean}"/>
</h:selectOneMenu>
<h:outputLabel for="sel_group" value="#{messages['user_coporation']}"></h:outputLabel>
<h:selectOneMenu id="sel_group" value="#{registerBean.user_Group}">
<f:selectItems value="#{registerBean.groupBean}"/>
</h:selectOneMenu>
<h:outputLabel for="sel_role" value="#{messages['user_role']}"></h:outputLabel>
<h:selectOneMenu id="sel_role" value="#{registerBean.user_Role}">
<f:selectItems value="#{registerBean.roleBean}"/>
</h:selectOneMenu>
<h:commandButton id="putOn" value="#{messages['register_puton']}" actionListener="#{registerBean.RegisterUser}"></h:commandButton>
</h:panelGrid>
</td>
</tr>
</tbody>
<tfoot>
<h:outputText value="#{messages.register_welcome}"></h:outputText>
</tfoot>
</table>
</h:form>
</body>
</html>
</f:view>managed bean :
package com.data.analysis.security.web;import java.util.ArrayList;
import java.util.List;import javax.faces.event.ActionEvent;import com.data.analysis.security.bo.ActionBean;
import com.data.analysis.security.bo.GroupBean;
import com.data.analysis.security.bo.RoleBean;
import com.data.analysis.security.bo.UserBean;import javax.faces.model.SelectItem;public class RegisterBackBean extends RegisterBackBaseBean
{
private String user_ID; //用户名
private String user_Password1; //密码
private String user_Password2;
private String user_Privilege; //所属组或者部门
private String user_Role; //角色 (高级管理员,,中级管理员,初级用户)
private String user_Group; //权限级别 (与角色对应)
private List<SelectItem> actionBean;
private List<SelectItem> groupBean;
private List<SelectItem> roleBean;
private List<ActionBean> list1;
private List<GroupBean> list2;
private List<RoleBean> list3;
........余下的没写出来
}
异常
2007-11-06 14:41:47,250 [http-8084-Processor22] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ElectronTax].[Faces Servlet] - Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /WebProject/GroupCreate.jsp][Class: javax.faces.component.html.HtmlForm,Id: _idJsp0][Class: javax.faces.component.html.HtmlPanelGrid,Id: _idJsp1][Class: javax.faces.component.html.HtmlInputText,Id: groupname]}
解决方案 »
- axis demo出错
- 初学SPRING疑问,找不到bean?
- javascript 中form 提交方式区别的问题
- 夏昕的SpringGuide 一书源码在哪里下载
- JSF新手:又是关于tomcat报错!
- 请教以下代码问题!急啊~~~~
- 有没有办法做一个button点击以后去执行一个Java类的方法呢?
- 处理checkbox小技巧!
- 请问有谁做过触摸屏软件开发吗?请指教指教!!
- java 能够编译执行并且正确,在jsp中却不能执行(顺便问一下怎么给分,总是提示给的分数不够总数)?
- 求一个WEB项目经常出现的漏洞?
- jsp中在那可以保存连接字符串就象asp.net中的web.config文件那样
我用过struts标签 webwork标签 像你这种用法还真没用过。
这2个标签库有在servlet配置文件中注册?
javax.faces.component.UIViewRoot,ViewId: /WebProject/GroupCreate.jsp][Class: javax.faces.component.html.HtmlForm,Id: _idJsp0]
详细察看系统日志,输出比较详细一点。