你的目录中是否有这个类dw.strust.example.ValidateEmployeeAction;
或者ValidateEmployeeAction这个类经过编译后是否放到了classes\dw\strustexample目录下?
或者ValidateEmployeeAction这个类经过编译后是否放到了classes\dw\strustexample目录下?
解决方案 »
- 在网页上能显示和修改本地的xml文件,最好是使用extjs的树形控件,请高手指教,在线等....
- 如何实现快递查询接口
- win7下用runtime.getRuntime().exec()调用cmd命令ping的问题
- Spring 3 使用-处理整个框架全局的异常
- 初学SOAP... 大家给讲讲关于SOAP的几个问题....
- was6.1中jsp编译问题
- Status 安装在tomcat 中运行为什么会报以下问题???
- 如何统计一个JAVA项目中的代码行数?
- 是不是ejb的部署存在问题呢?
- gson对map的list集合的json转换
- 请高手指点一上JSTL怎么配置啊??
- 关于weblogic启动时的错误问题
<!--param-name>application</param-name>
改为
<param-name>application</param-name>
dw.strust.example.ValidateEmployeeAction
在classes\dw\strust\example\下的2.
我现在已经没有用<bean:message>所以我把
<!--param-name>application</param-name>
<param-value>ApplicationResources</param-value-->注释了3.
我把web.xml里的
<load-on-startup>2</load-on-startup>
注释了,现在能启动了,但在打开web页面inputContent.jsp的时候出现
org.apache.jasper.JasperException: /inputContent.jsp(35,6) jsp.error.unterminated.tag
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
...
现在我把inputContent.jsp里的所有用的标签都去掉了
就保留
<%@ taglib uri="/html" prefix="html"%>
还是有这个错误,感觉是<%@ taglib uri="/html" prefix="html"%>
错了,但不知道哪里错了。。
请高手帮我分析一下,挽救一个郁闷了一个星期的人,谢谢
<%@ taglib uri="/WEB-INF/Struts-html.tld" prefix="html" %>
你要保证你的WEB-INF文件夹下有Struts-html.tld文件
以及其他文件
将其中的uri和web.xml中taglib中定义的uri写成一致!
在inputContent.jsp里保留
<%@ taglib uri="/html" prefix="html"%>
<%@ taglib uri="/bean" prefix="bean"%>
<%@ taglib uri="/logic" prefix="logic"%>
<%@ taglib uri="/app" prefix="app"%>
页面能打开了但是如过一旦加了
<html:text property="name"/>标签
打开页面就出现错误:
org.apache.jasper.JasperException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
..
大概意思是不能找到这个org.apache.struts.taglib.html.BEAN 在 any scope
是什么原因呢而且我把<html:text property="name"/>删了,
改为
<html:form action="validateEmployee.do">
</html:form>
打开页面就出现错误:
org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)也就是说现在,只要使用了标签就出错,请教各位是什么原因引起的呢?谢谢你们
你有这样的标签的话,你的ActionForm这个bean中一定有一个成员名称是name,这个名称和property是对应的,在提交时,你的这些数据会被control servlet提交到你写的那个ActionForm去组合数据,如果你的表单中的property和那个bean中的成员不对应的话,就会出现问题!
你是否写了ActionForm了
struts-config.xml里的配置映射问题?
一个是EmployeeForm:
package dw.strust.example;
import org.apache.struts.action.ActionForm;/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class EmployeeForm extends ActionForm{
private String name = "";
private String department = "";
private String[] skills; public String getName(){
return name;
} public void setName(String name){
this.name = name;
} public String getDepartment(){
return department;
} public void setDepartment(String department){
this.department = department;
} public String[] getskills(){
return skills;
} public void setSkills(String[] skills){
this.skills = skills;
}
public EmployeeForm() {
}
}一个是ValidateEmployeeAction:package dw.strust.example;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.List;/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class ValidateEmployeeAction extends Action{
public ValidateEmployeeAction() {
} public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,ServletException{
ActionErrors errors = new ActionErrors();
EmployeeForm empForm = (EmployeeForm)form; String name = empForm.getName();
if(name.trim().equals("")){
ActionError error = new ActionError("error.missing.name");
errors.add(ActionErrors.GLOBAL_ERROR,error);
} String department = empForm.getDepartment();
if(department.trim().equals("")){
ActionError error = new ActionError("error.missing.department");
errors.add(ActionErrors.GLOBAL_ERROR,error);
} String[] skills = empForm.getskills();
if(skills == null){
ActionError error = new ActionError("error.missing.skills");
errors.add(ActionErrors.GLOBAL_ERROR,error);
} return mapping.findForward("success");
}
}
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="empForm" type="dw.strust.example.EmployeeForm"/>
</form-beans>
<action-mappings>
<action path="/validateEmployee" type="dw.strust.example.ValidateEmployeeAction" name="empForm scope="request" input="/inputContent.jsp">
<forward name="success" path="/outputContent.jsp"/>
</action>
</action-mappings>
</struts-config> 现在启动没错误了,
就是运行inputContent.jsp页面的时候出先错误
org.apache.jasper.JasperException: /inputContent.jsp(21,5) No such tag test in the tag library imported with prefix htmlat org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:705)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:804)
<%@ taglib uri="/html" prefix="html"%>
<%@ taglib uri="/bean" prefix="bean"%>
<%@ taglib uri="/logic" prefix="logic"%>
<%@ taglib uri="/app" prefix="app"%>
<html>
<head>
<title></title>
</head>
<body>
<html:errors/>
<app:departmentList/>
<app:skillsList/>
<html:form action="validateEmployee.do">
<table>
<tr>
<td align="right">
name
</td>
<td>
<html:test property="name"/>
</td>
</tr>
<tr>
<td align="center">
department
</td>
<td>
<html:select property="department">
<html:options name="departmentList"/>
</html:select>
</td>
</tr>
<tr>
<td align="right" valign="top">
skills
</td>
<td>
<logic:iterate id="curentSkill" name="skillsList">
<html:multibox property="skills">
<%= currentSkill %>
</html:multibox>
</logic:iterate>
</td>
</tr>
<tr>
<td colspan="2" align="center">
</td>
</tr>
</table>
</html:form>
</body>
</html>
test->text但还是提示
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] D:\javaTool\Tomcat 4.1\work\Standalone\localhost\dwtest\inputContent_jsp.java:159: cannot resolve symbol
[javac] symbol : variable currentSkill
[javac] location: class org.apache.jsp.inputContent_jsp
[javac] out.print( currentSkill );
[javac] ^
[javac] 1 error
改成<html:text property="name"/>
<logic:iterate id="curentSkill" name="skillsList">
<html:multibox property="skills">
<%= currentSkill %>
</html:multibox>
</logic:iterate>还是出现这个错误:
org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection
到底是什么原因呢,
改成<bean:write name="currentSkill"/>看看!
你把上面的那行去掉当然不行啊,这样在ActionForm bean中就不能找到和skills对应的property了!
org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection
WEB-INF/lib/下有struts.jar
WEB-INF/classes/下有dw.strust.example.EmployeeForm
和dw.strust.example.ValidateEmployeeAction
WEB-INF/下有struts-logic.tld,struts-bean.tld,struts-html.tld,struts-config.xml
web.xml,app.tld我现在已经把表单只设置了一个字段了,就一个name
EmployeeForm.java里面就一个name属性:package dw.strust.example;
import org.apache.struts.action.ActionForm;
public class EmployeeForm extends ActionForm{
private String name = ""; public String getName(){
return name;
} public void setName(String name){
this.name = name;
}
public EmployeeForm() {
}
}ValidateEmployeeAction.java也只留下了name判断:
package dw.strust.example;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.List;/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class ValidateEmployeeAction extends Action{
public ValidateEmployeeAction() {
} public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,ServletException{
ActionErrors errors = new ActionErrors();
EmployeeForm empForm = (EmployeeForm)form; String name = empForm.getName();
if(name.trim().equals("")){
ActionError error = new ActionError("error.missing.name");
errors.add(ActionErrors.GLOBAL_ERROR,error);
System.out.println("sssss");
}
return mapping.findForward("success");
}
}struts-config.xml内容:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="empForm" type="dw.strust.example.EmployeeForm"/>
</form-beans>
<action-mappings>
<action path="/validateEmployee" type="dw.strust.example.ValidateEmployeeAction" name="empForm scope="request" validate="true" input="/inputContent.jsp">
<forward name="success" path="/outputContent.jsp"/>
</action>
</action-mappings>
</struts-config> inputContent.jsp内容:
<%@ taglib uri="/html" prefix="html"%>
<%@ taglib uri="/bean" prefix="bean"%>
<%@ taglib uri="/logic" prefix="logic"%>
<%@ taglib uri="/app" prefix="app"%> //自己的定义的标签
<html>
<head>
<title></title>
</head>
<body>
<html:form action="/validateEmployee.do">
<table>
<tr>
<td align="right">
name
</td>
<td>
<html:text property="name"/>
</td>
</tr>
</table>
</html:form>
</body>
</html>
哪位大哥救命啊,我不想在郁闷一个星期,谢谢高手和前辈帮忙指点分析,已经很尽力了,,快疯了
name后面的值少个引号啊!name="empForm
<taglib>
<taglib-uri>struts/bean-el</taglib-uri>
<taglib-location>/WEB-INF/struts-bean-el.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>struts/html-el</taglib-uri>
<taglib-location>/WEB-INF/struts-html-el.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>struts/logic-el</taglib-uri>
<taglib-location>/WEB-INF/struts-logic-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jstl/c</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
在web.xml中配置以上这些了吗??
<%@ taglib uri="struts/html-el" prefix="html" %>
开始我还以为是没有
<global-forwards>
<forward name="failed" path="/failed"/>
<forward name="success" path="/success.do"/>
</global-forwards>
而出错的,现在不管加还是去,都对了,
在action 里面+forwrad 也对了,郁闷
<action path="/validateEmployee" type="dw.strust.example.ValidateEmployeeAction" name="empForm scope="request" validate="true" input="/inputContent.jsp">
<forward name="success" path="/outputContent.jsp"/>
</action>
不知不觉自己就好了,~~~~~~
哎。。
谢谢大家,帮助我,真是谢谢你们,,你们都是好人,我爱你们:)