struts调试出错

04-03-25 mikecaolei
我在用struts做试验时,步骤都是按照中国计算机网,赛迪网上的“struts国际化程序尝试 ”一文做,调试了一下,系统报错

500 Servlet Exception

java.lang.NullPointerException

at org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1219)

at org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082)

at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:226)

at _index__jsp._jspService(/logonapp/index.jsp:8)

at com.caucho.jsp.JavaPage.service(JavaPage.java:75)

at com.caucho.jsp.Page.subservice(Page.java:497)

at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)

at com.caucho.server.http.Invocation.service(Invocation.java:312)

at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)

at caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342)

at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272)

at com.caucho.server.TcpConnection.run(TcpConnection.java:137)

at java.lang.Thread.run(Thread.java:534)

请高手能不能帮我解释一下,什么原因?

laoer
2004-03-25 16:04
标记库出错,是不是配置不正确,注意strtus-config.xml或是web.xml中关于资源文件的配置

mikecaolei
2004-03-25 17:19
这是struts-config.xml部分

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"

"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<form-beans>

<form-bean name="logonForm" type="org.apache.struts.validator.DynaValidatorForm">

<form-property name="username" type="java.lang.String"/>

<form-property name="password" type="java.lang.String"/>

</form-bean>

</form-beans>

<global-forwards>

<forward name="success" path="/main.jsp"/>

<forward name="logoff" path="/logoff.do"/>

</global-forwards>

<action-mappings>

<action path="/logon"

type="org.monotonous.struts.LogonAction"

name="logonForm"

scope="session"

input="logon">

</action>

<action path="/logoff" type="org.monotonous.struts.LogoffAction">

<forward name="success" path="/index.jsp"/>

</action>

</action-mappings>

<controller>

<!-- The "input" parameter on "action" elements is the name of a

local or global "forward" rather than a module-relative path -->

<set-property property="inputForward" value="true"/>

</controller>

<message-resources parameter="org.monotonous.struts.ApplicationResources"/>

</struts-config>

这是web.xml部分

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>

<!-- Action Servlet Configuration -->

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet

</servlet-class>

<init-param>

<param-name>config</param-name>

param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<!-- Action Servlet Mapping -->

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<!-- The Welcome File List -->

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

<!-- Struts Tag Library Descriptors -->

<taglib>

<taglib-uri>/tags/struts-bean.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tags/struts-html.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tags/struts-logic.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>

</taglib>

</web-app>

这是index.jsp部分

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="/tags/struts-bean.tld" prefix="bean" %>

<%@ taglib uri="/tags/struts-html.tld" prefix="html" %>

<%@ taglib uri="/tags/struts-logic.tld" prefix="logic" %>

<html:html locale="true">

<head>

<title><bean:message key="index.title"/></title>

<html:base/>

</head>

<body>

<html:errors/>

<html:form action="/logon">

<bean:message key="prompt.username"/>

<html:text property="username"/>

<br/>

<bean:message key="prompt.password"/>

<html:password property="password"/>

<br/>

<html:submit>

<bean:message key="index.logon"/>

</html:submit>

</html:form>

</body>

</html:html>

麻烦高手看看,我觉得没错

mikecaolei
2004-03-25 17:21
这是struts-config.xml部分

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>  
<form-beans>   
	<form-bean name="logonForm" type="org.apache.struts.validator.DynaValidatorForm"> 
		<form-property name="username" type="java.lang.String"/>
		<form-property name="password" type="java.lang.String"/> 
	</form-bean>
</form-beans> 
<global-forwards> 
	<forward   name="success" path="/main.jsp"/>
	<forward   name="logoff"  path="/logoff.do"/>
</global-forwards> 
<action-mappings> 
	<action path="/logon"
			type="org.monotonous.struts.LogonAction"    
			name="logonForm"     
			scope="session"       
			input="logon">    
	</action>   
	<action    path="/logoff" type="org.monotonous.struts.LogoffAction"> 
		<forward name="success" path="/index.jsp"/>  
	</action> 
</action-mappings> 
<controller>  
<!-- The "input" parameter on "action" elements is the name of a       
local or global "forward" rather than a module-relative path --> 
	<set-property property="inputForward" value="true"/> 
</controller>

<message-resources parameter="org.monotonous.struts.ApplicationResources"/>

</struts-config>
<p>

这是web.xml部分

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
	<!-- Action Servlet Configuration -->  
	<servlet>
<servlet-name>action</servlet-name> 
<servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>      
<param-name>config</param-name>
param-value>/WEB-INF/struts-config.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup> 
	</servlet>
	<!-- Action Servlet Mapping -->
	<servlet-mapping>    
		<servlet-name>action</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	<!-- The Welcome File List -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<!-- Struts Tag Library Descriptors -->  
	<taglib>    
<taglib-uri>/tags/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
	</taglib>
	<taglib>    
<taglib-uri>/tags/struts-html.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-html.tld</taglib-location> 
	</taglib> 
	<taglib> 
<taglib-uri>/tags/struts-logic.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location> 
	</taglib>
</web-app>

<p>

这是index.jsp部分

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/tags/struts-html.tld" prefix="html" %> 
<%@ taglib uri="/tags/struts-logic.tld" prefix="logic" %> 

<html:html locale="true">
<head>
  <title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body>
<html:errors/>
<html:form action="/logon">
  <bean:message key="prompt.username"/>
    <html:text property="username"/>
      <br/>
      <bean:message key="prompt.password"/>
      <html:password property="password"/>
      <br/>
      <html:submit>
          <bean:message key="index.logon"/>
      </html:submit>
</html:form>
</body>
</html:html>
<p>

麻烦高手看看,我觉得没错

javapopo
2004-03-25 17:28
<% for (int i=1;i<=1000;i++){ %>

<p><br>

<input name="txtPass" type="password" size="14">

<% }%>

猜你喜欢
2Go 1 2 下一页