文本框文字太多提交不上去提示400错误

shyar 发布于 2013/03/04 09:25
阅读 453
收藏 0
用的Strut2 ,提交提示400错误,后台也检测不到数据,如果文本框的文字少一点就正常

以下是问题补充:

@shyar:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd" > <struts> <!--<constant name="struts.action.extension" value="html"></constant> <constant name="struts.devMode" value="true"></constant> <constant name="struts.ui.theme" value="simple"></constant> <constant name="struts.custom.i18n.resources" value="message"/>--> <constant name="struts.multipart.saveDir" value="C:\\Users\\huang_xh\\Desktop\\temp"/> <constant name="struts.i18n.encoding" value="UTF-8"/> <constant name="struts.objectFactory" value="spring"></constant> <constant name="struts.multipart.maxSize" value="3000000000"/> <package name="userAccess" extends="tiles-default"> <interceptors> <interceptor name="userAccessLoginIncerceptor" class="com.zhonghua.proj.interceptor.UserAccessLoginIncerceptor"> <param name="excludeActions">toLoginUser,changLangSystemSetting,loginUser</param> </interceptor> <interceptor-stack name="myDefaultStack"> <interceptor-ref name="userAccessLoginIncerceptor"></interceptor-ref> <interceptor-ref name="defaultStack"></interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="myDefaultStack"></default-interceptor-ref> <action name="*SystemSetting" class="systemSettingAction" method="{1}"> <result name="{1}" type="tiles">{1}SystemSetting</result> </action> <action name="*UploadJson" class="uploadJsonAction" method="{1}"> </action> <action name="*Screen" class="sysScreenMasterAction" method="{1}"> <result name="{1}" type="tiles">{1}ScreenTile</result> </action> <action name="*Action" class="sysActionMasterAction" method="{1}"> <result name="{1}" type="tiles">{1}ActionTile</result> </action> <action name="*Group" class="sysGroupMasterAction" method="{1}"> <result name="{1}" type="tiles">{1}GroupTile</result> </action> <action name="*User" class="sysUserMasterAction" method="{1}"> <result name="{1}" type="tiles">{1}UserTile</result> <result name="toLogin" type="tiles">login</result> <result name="goAccess" type="tiles">rmMain</result> <result name="allMain" type="tiles">grms-main</result> <result name="ReGuManager" type="redirect">managerGroup?userID=${user.userId}</result> <result name="manager" type="tiles">managerUserTile</result> </action> <action name="*News" class="newsAction" method="{1}"> <result name="toMain" type="redirect">toMainNews</result> <result name="toContent" type="redirect">toContentNews?news.newsId=${news.newsId}</result> <result name="{1}" type="tiles">{1}News</result> </action> </package> </struts> (2013/03/04 10:04)
@shyar:<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost"> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!-- The request dumper valve dumps useful debugging information about the request and response data received and sent by Tomcat. Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.valves.RequestDumperValve"/> --> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <!-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. --> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> --> </Host> </Engine> </Service> </Server> (2013/03/04 10:05)
加载中
0
红薯
红薯
应用服务器限制了最大的 request body
shyar
shyar
我用的是tomcat,请问一下怎么设置,拜托大虾
0
红薯
红薯
你给一下具体的数字,多大才会出错,另外给出tomcat和struct的配置
shyar
shyar
就一篇文章的大小,大概1000多字左右,是一个新闻编辑器,提交的数据
0
恺哥
恺哥

检查一下tomcat的日志,看看是否得到了类似“post data too big”异常

如果是这个异常的话,可以通过调整属性来尝试解决:

tomcat server.xml的<connector>有一个属性是maxPostSize,它默认是2m

调大一些或者将其设置成0(关闭limit)

调一下看看

shyar
shyar
回复 @恺哥 : ToT,非常感谢你
恺哥
恺哥
回复 @shyar : http://tomcat.apache.org/tomcat-6.0-doc/config/http.html 这里有参考配置,是6.0的
shyar
shyar
哦,谢谢,我试一下
0
dedenj
dedenj
不会是超过数据库字段的长度了吧
0
恺哥
恺哥

引用来自“dede.g”的答案

不会是超过数据库字段的长度了吧
还没到数据库那呢
0
shyar
shyar

引用来自“恺哥”的答案

引用来自“dede.g”的答案

不会是超过数据库字段的长度了吧
还没到数据库那呢
0
shyar
shyar

引用来自“恺哥”的答案

检查一下tomcat的日志,看看是否得到了类似“post data too big”异常

如果是这个异常的话,可以通过调整属性来尝试解决:

tomcat server.xml的<connector>有一个属性是maxPostSize,它默认是2m

调大一些或者将其设置成0(关闭limit)

调一下看看

好像没有效果,会不会是struts2的配置问题
0
恺哥
恺哥

引用来自“shyar”的答案

引用来自“恺哥”的答案

检查一下tomcat的日志,看看是否得到了类似“post data too big”异常

如果是这个异常的话,可以通过调整属性来尝试解决:

tomcat server.xml的<connector>有一个属性是maxPostSize,它默认是2m

调大一些或者将其设置成0(关闭limit)

调一下看看

好像没有效果,会不会是struts2的配置问题
确信配置完后,重新启动tomcat了吧?
恺哥
恺哥
回复 @shyar : 我建议你还是先把log信息找到,然后从log下手,出问题的话,肯定会报异常的
shyar
shyar
恩,重启了
0
shyar
shyar

谢谢你们哦

是form默认为get了

改成post就好了

喜欢犯低级错误

返回顶部
顶部