首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

struts1.3 异常 找了 一天了

2012-05-28 
struts1.3错误找了 一天了编的 一个简单的表单提交 可是总是 http400 在java吧 还被删帖唉index.jspHTML c

struts1.3 错误 找了 一天了
编的 一个简单的表单提交 可是总是 http400 在java吧 还被删帖 唉

index.jsp

HTML code
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body><form method="POST"action="login.do"><input type="text" name="loginName"><input type="password" name="loginPass"><input type="submit" value="submit" ></body></html>


struts-config.xml
XML code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts-config SYSTEM "http://struts.apache.org/dtds/struts-config_1_3.dtd" ><struts-config>        <form-beans>                <form-bean name="LoginForm" type="app.LoginForm" />        </form-beans>         <action-mappings>                <action path="login" type="app.LoginAction"                        name="LoginForm" validate="false" scope="request">                         <forward name="success" path="/success.html" />                        <forward name="failure" path="/failure.html" />                </action>        </action-mappings></struts-config>


[解决办法]
1.确定你的web.xml里面配置了struts的相关信息
2.你的HTML的form没有闭合,在按钮之后加上</form>
[解决办法]
表单没有闭合</form>
现在很多公司都用struts2了 建议你看看 它比struts1更好 我跟人感觉编写起来更简洁了
[解决办法]
struts-config.xml配置的action路径加上/
XML code
        <action-mappings>                <action path="/login" type="app.LoginAction"                        name="LoginForm" validate="false" scope="request">                         <forward name="success" path="/success.html" />                        <forward name="failure" path="/failure.html" />                </action>        </action-mappings>
[解决办法]
method的post可以大写?

热点排行