我的应用程序的某些页面运行得很好。但接下来我们来看看这段代码:
<s:form id="filter" action="./filtro_BuscaAdm.html" validate="false">
<s:hidden key="newFiltro" value="true"/>
<s:textfield id="buscaGen" key="campoBusca" />
<input type="text" name="x" class="displayNone"/>
<s:submit onclick="return validarBusca();" label="Filtrar" targets="dados"
value="Filtrar" type="image" src="../images/searchButton.png" "/>
</s:form>
呈现此页面时会出现以下异常:
错误ClosingUIBean无法打开模板 java.lang.NullPointerException at org.apache.struts2.components.ServletUrlRenderer.renderFormUrl(ServletUrlRenderer.java:135) 在 org.apache.struts2.components.Form.populateComponentHtmlId(Form.java:232) 在 org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:816) 在 org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:55) 在 org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54) 在 org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fform_005f0(default_jsp.java:1483) 在 org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:326)
和
java.lang.NullPointerException at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:824) 在org.apache.struts2.components.UIBean.end(UIBean.java:535)at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) 在 org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fhidden_005f0(default_jsp.java:1542) 在 org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fform_005f0(default_jsp.java:1493)
如果我将<s:form>
更改为<form>
,则会正常呈现
在其他页面中,<s:form>
代码正常呈现
我已经好几个星期了。我们使用maven来解决依赖关系
这是我一直在用我的发现写作的一步一步:
更改pom中的jar版本(duh)
不推荐使用ActionContextCleanUp过滤器。将其删除
FilterDispatcher现在是StrutsPrepareAndExecuteFilter
更新commons-lang,commons-fileupload,删除xwork和ognl jars
相应地更改struts.xml(拦截器名称和标头版本声明)
在这些步骤之后,我能够在没有构建错误的情况下部署应用程序。然后我跑了几个jsp erros并且一个接一个地解决它们。到目前为止,我发现了:
<s:>
内的<form>
标记会触发&#34; freemarker&#34;例外。 &#34; S&#34;标签只允许在&#34; S&#34;部件
其他信息:
Javax.servlet版本是2.4
我可以将xwork jar添加到类路径中。没什么区别。但我认为我不应该添加它,因为它的核心包含在struts-2.5-core.jar
中我已经浏览了apache.org迁移指南和stackoverflow,但无法找到与此相关的任何内容
这是web.xml文件,已满。 &#34; BrainwebFilterDispatcher&#34; Filter扩展了StrutsPrepareAndExecuteFilter
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>Petz</display-name>
<!-- Define the basename for a resource bundle for I18N -->
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>messages</param-value>
</context-param>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<listener>
<listener-class>br.com.stoom.web.SessionCounter</listener-class>
</listener>
<filter>
<filter-name>threadFilter</filter-name>
<filter-class>br.com.stoom.threads.ThreadFilter</filter-class>
</filter>
<filter>
<filter-name>securityFilter</filter-name>
<filter-class>br.com.stoom.web.SecurityFilter</filter-class>
</filter>
<filter>
<filter-name>exportFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter>
<filter-name>aberturaEmailFilter</filter-name>
<filter-class>br.com.stoom.web.AberturaEmailFilter</filter-class>
</filter>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>br.com.stoom.web.RewriteFilter</filter-class>
</filter>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>messageFilter</filter-name>
<filter-class>br.com.stoom.web.MessageFilter</filter-class>
</filter>
<filter>
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter>
<filter-name>lojaFilter</filter-name>
<filter-class>br.com.stoom.web.LojaFilter</filter-class>
</filter>
<filter>
<filter-name>struts</filter-name>
<filter-class>br.com.stoom.web.BrainwebFilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>br.com.stoom.web</param-value>
</init-param>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
<filter-name>cacher</filter-name>
<filter-class>br.com.stoom.web.CacheFilter</filter-class>
</filter>
<filter>
<filter-name>gzipper</filter-name>
<filter-class>br.com.stoom.web.GZIPFilter</filter-class>
</filter>
<filter>
<filter-name>wsfilter</filter-name>
<filter-class>br.com.stoom.web.WebServiceFilter</filter-class>
</filter>
<filter>
<filter-name>jsCssMinify</filter-name>
<filter-class>br.com.stoom.web.JsCssMinifyFilter</filter-class>
</filter>
<filter>
<filter-name>blocker</filter-name>
<filter-class>br.com.stoom.web.BlockFilter</filter-class>
</filter>
<filter>
<filter-name>logger</filter-name>
<filter-class>br.com.stoom.web.LogFilter</filter-class>
</filter>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
<filter-mapping>
<filter-name>blocker</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>logger</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>cacher</filter-name>
<url-pattern>*.html</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>gzipper</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>gzipper</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>messageFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>*.html</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>*.xml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>exportFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>lojaFilter</filter-name>
<url-pattern>*.html</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>wsfilter</filter-name>
<url-pattern>/wsIntegracao</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>logger</filter-name>
<url-pattern>/wsIntegracao</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>wsfilter</filter-name>
<url-pattern>/wsIntegracao/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>aberturaEmailFilter</filter-name>
<url-pattern>/envio-email/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>threadFilter</filter-name>
<url-pattern>*.thread</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>jsCssMinify</filter-name>
<url-pattern>*.js</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>jsCssMinify</filter-name>
<url-pattern>*.css</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>cssServlet</servlet-name>
<servlet-class>br.com.stoom.web.CssServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>cssServlet</servlet-name>
<url-pattern>/styles/loja/general.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/xservices/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/wsIntegracao</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/wsIntegracao/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>inc</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFile</param-name>
<param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsImage</param-name>
<param-value>jpg|gif|jpeg|png|bmp</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/tinyfck/filemanager/connectors/jsp/connector</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/tinyfck/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/503.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
</web-app>
以下是应用程序中包含的完整的jar列表。这是一个非常大的应用程序。也许不是所有这些都需要(我们在这一点上失去了轨道),但大多数都是。最后是与弹簧和支柱有关的罐子
> oauth-20100527.jar google-collections-1.0-rc2.jar HikariCP-2.3.8.jar
> javassist-3.18.2-GA.jar lucene-core-3.3.0.jar
> google-shopping-1.4.1.jar gdata-analytics-2.1.jar gdata-core-1.0.jar
> janalytics-1.0.jar jcommon-1.0.16.jar urlrewrite-2.5.2.jar
> dsn-1.4.5.jar javax.mail-1.4.5.jar activation-1.1.jar
> jasperreports-1.2.1.jar commons-digester-2.1.jar
> commons-logging-1.2.jar jfreechart-1.0.1.jar xml-apis-1.3.02.jar
> jdtcore-3.2.0.v_658.jar ajaxtags-1.1.5.jar jericho-html-1.5-dev1.jar
> spectjweaver-1.5.2a.jar commons-dbcp-1.2.2.jar commons-pool-1.3.jar
> commons-collections-3.2.jar
>
> commons-fileupload-1.3.2.jar commons-io-2.2.jar
> commons-httpclient-3.0.jar commons-codec-1.2.jar displaytag-1.1.1.jar
> itext-1.3.jar jcl104-over-slf4j-1.4.2.jar lf4j-log4j12-1.4.2.jar
> 2.0.1\dwr-2.0.1.jar jmock-1.1.0.jar junit-4.4.jar jwebunit-1.2.jar nekohtml-
0.8.1.jar httpunit-1.6.jar xmlParserAPIs-2.2.1.jar
> jtidy-4aug2000r7-dev.jar hibernate-3.2.5.ga.jar ehcache-1.2.3.jar
> jta-1.0.1B.jar asm-attrs-1.5.3.jar antlr-2.7.6.jar cglib-2.1_3.jar
> asm-1.5.3.jar hibernate-annotations-3.3.0.ga.jar
> persistence-api-1.0.jar hibernate-commons-annotations-3.3.0.ga.jar
> log4j-1.2.13.jar mysql-connector-java-5.0.5.jar
> postgresql-9.3-1103-jdbc41.jar jstl-1.1.2.jar log4j-api-2.5.jar
> commons-lang3-3.4.jar asm-commons-3.3.jar asm-tree-3.3.jar
> aopalliance-1.0.jar xfire-all-1.2.6.jar xfire-aegis-1.2.6.jar
> stax-utils-20040917.jar xfire-ws-security-1.2.6.jar opensaml-1.0.1.jar
> bcprov-jdk15-133.jar xercesImpl-2.7.1.jar xmlsec-1.3.0.jar
> wss4j-1.5.1.jar commons-discovery-0.2.jar xfire-core-1.2.6.jar
> wsdl4j-1.6.1.jar jaxen-1.1-beta-9.jar XmlSchema-1.1.jar
> wstx-asl-3.2.0.jar jdom-1.0.jar xfire-java5-1.2.6.jar
> xfire-jsr181-api-1.0-M1.jar xfire-generator-1.2.6.jar
> xfire-jaxb2-1.2.6.jar jaxb-xjc-2.0.1.jar jaxb-impl-2.0.1.jar
> xfire-xmlbeans-1.2.6.jar xbean-2.2.0.jar xfire-annotations-1.2.6.jar
> commons-beanutils-1.7.0.jar commons-attributes-api-2.1.jar ant-1.5.jar
> qdox-1.5.jar xfire-jaxws-1.2.6.jar jaxws-api-2.0.jar jaxb-api-2.0.jar
> jsr173_api-1.0.jar saaj-impl-1.3.jar saaj-api-1.3.jar
> xfire-spring-1.2.6.jar xbean-spring-2.8.jar commons-email-1.1.jar
> cachefilter-1.0.1.jar slf4j-api-1.4.3.jar quartz-1.8.3.jar poi-3.9.jar
> poi-ooxml-3.9.jar poi-ooxml-schemas-3.9.jar xmlbeans-2.3.0.jar
> stax-api-1.0.1.jar dom4j-1.6.1.jar httpclient-4.2.1.jar
> httpcore-4.2.1.jar java-image-scaling-0.8.5.jar filters-2.0.235-1.jar
> jackson-core-2.3.0.jar jackson-databind-2.3.0.jar
> jackson-annotations-2.3.0.jar
> google-api-services-coordinate-v1-rev37-1.17.0-rc.jar
> google-api-client-1.17.0-rc.jar google-oauth-client-1.17.0-rc.jar
> google-http-client-jackson2-1.17.0-rc.jar
> google-http-client-1.17.0-rc.jar jsr305-1.3.9.jar
> google-http-client-appengine-1.17.0-rc.jar gson-2.2.4.jar
> aws-java-sdk-1.9.0.jar aws-java-sdk-directconnect-1.9.0.jar
> aws-java-sdk-core-1.9.0.jar joda-time-2.9.4.jar
> aws-java-sdk-logs-1.9.0.jar aws-java-sdk-elasticbeanstalk-1.9.0.jar
> aws-java-sdk-iam-1.9.0.jar aws-java-sdk-autoscaling-1.9.0.jar
> aws-java-sdk-emr-1.9.0.jar aws-java-sdk-cognitoidentity-1.9.0.jar
> aws-java-sdk-cloudwatchmetrics-1.9.0.jar
> aws-java-sdk-cloudwatch-1.9.0.jar aws-java-sdk-dynamodb-1.9.0.jar
> aws-java-sdk-ses-1.9.0.jar aws-java-sdk-swf-libraries-1.9.0.jar
> aws-java-sdk-simpleworkflow-1.9.0.jar
> aws-java-sdk-importexport-1.9.0.jar aws-java-sdk-support-1.9.0.jar
> aws-java-sdk-elasticache-1.9.0.jar aws-java-sdk-cloudfront-1.9.0.jar
> aws-java-sdk-opsworks-1.9.0.jar aws-java-sdk-storagegateway-1.9.0.jar
> aws-java-sdk-kinesis-1.9.0.jar aws-java-sdk-redshift-1.9.0.jar
> aws-java-sdk-cloudsearch-1.9.0.jar
> aws-java-sdk-cloudformation-1.9.0.jar aws-java-sdk-rds-1.9.0.jar
> aws-java-sdk-sts-1.9.0.jar aws-java-sdk-route53-1.9.0.jar
> aws-java-sdk-glacier-1.9.0.jar aws-java-sdk-sqs-1.9.0.jar
> aws-java-sdk-sns-1.9.0.jar aws-java-sdk-s3-1.9.0.jar
> aws-java-sdk-cloudtrail-1.9.0.jar aws-java-sdk-ec2-1.9.0.jar
> aws-java-sdk-cognitosync-1.9.0.jar aws-java-sdk-simpledb-1.9.0.jar
> aws-java-sdk-datapipeline-1.9.0.jar
> aws-java-sdk-elasticloadbalancing-1.9.0.jar
> aws-java-sdk-elastictranscoder-1.9.0.jar jbcrypt-0.3m.jar axis-1.4.jar
> axis-jaxrpc-1.4.jar javax.mail-api-1.5.4.jar maven-ant-tasks-2.1.3.jar
> ant-1.8.0.jar ant-launcher-1.8.0.jar classworlds-1.1-alpha-2.jar
> plexus-container-default-1.0-alpha-9-stable-1.jar
> plexus-utils-1.5.15.jar plexus-interpolation-1.11.jar
> maven-artifact-2.2.1.jar maven-artifact-manager-2.2.1.jar
> maven-repository-metadata-2.2.1.jar backport-util-concurrent-3.1.jar
> maven-model-2.2.1.jar maven-project-2.2.1.jar maven-profile-2.2.1.jar
> maven-plugin-registry-2.2.1.jar maven-error-diagnostics-2.2.1.jar
> maven-settings-2.2.1.jar wagon-file-1.0-beta-6.jar
> wagon-http-lightweight-1.0-beta-6.jar wagon-http-shared-1.0-beta-6.jar
> wagon-provider-api-1.0-beta-6.jar guava-r09.jar xpp3-1.1.6.jar
> akarta-regexp-1.4.jar struts2-json-plugin-2.5.1.jar
> chaordic-api-1.0.0.jar
> chaordic-api-with-dependencies-1.0.0-dependencies.jar
> fckeditor-2.3.jar yuicompressor-2.3.6.jar mundipagg-1.0.jar
> sinetfactory-1.0.jar
> google-api-services-analytics-v3-rev116-1.20.0.jar
> (twelvemonkeys)imageio-jpeg-3.1.1.jar
> (twelvemonkeys)imageio-core-3.1.1.jar
> (twelvemonkeys)imageio-metadata-3.1.1.jar
> (twelvemonkeys)common-lang-3.1.1.jar
> (twelvemonkeys)common-io-3.1.1.jar
> (twelvemonkeys)common-image-3.1.1.jar (twelvemonkeys)servlet-3.1.1.jar
> ckeditor.filebrowser-3.5.2.0.jar rest-api-sdk-1.2.9.jar
> thumbnailator-0.4.8.jar
> ognl-3.1.8.jar
> commons-lang-2.6.jar
> servlet-api-2.4.jar
> (taglibs)standard-1.1.2.jar
> sitemesh-2.4.1.jar
> struts2-core-2.5.1.jar
> freemarker-2.3.23.jar
> struts2-jasperreports-plugin-2.5.1.jar
> struts2-spring-plugin-2.5.1.jar
> spring-core-3.2.14.RELEASE.jar
> spring-context-support-3.2.14.RELEASE.jar
> spring-beans-3.2.14.RELEASE.jar spring-context-3.2.14.RELEASE.jar
> spring-aop-3.2.14.RELEASE.jar spring-webmvc-3.2.14.RELEASE.jar
> spring-expression-3.2.14.RELEASE.jar spring-web-3.2.14.RELEASE.jar
> spring-orm-3.2.14.RELEASE.jar spring-jdbc-3.2.14.RELEASE.jar
> spring-tx-3.2.14.RELEASE.jar