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

兄弟们帮小弟我看看,小弟我初学者不看不出那里出错了啊

2013-09-11 
兄弟们帮我看看,我菜鸟不看不出那里出错了啊!访问msg.jsp报下面的错误:HTTP Status 500 -----------------

兄弟们帮我看看,我菜鸟不看不出那里出错了啊!

访问msg.jsp报下面的错误:

HTTP Status 500 - 

--------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: Exception in JSP: /msg.jsp:19

16: </head>
17:  
18: <body>
19: <html:form action="MsgAction.do" method="post">
20: <table border="0">
21: <tr>
22: <td>Title:</td>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

javax.servlet.ServletException: Cannot retrieve mapping for action /MsgAction
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.msg_jsp._jspService(org.apache.jsp.msg_jsp:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /MsgAction
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:753)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.msg_jsp._jspx_meth_html_form_0(org.apache.jsp.msg_jsp:145)
org.apache.jsp.msg_jsp._jspx_meth_html_html_0(org.apache.jsp.msg_jsp:118)
org.apache.jsp.msg_jsp._jspService(org.apache.jsp.msg_jsp:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.


下面是我的web.xml和struts-config.xml:
web.xml

<?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" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <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>
  <init-param>
  <param-name>debug</param-name>
  <param-value>3</param-value>
  </init-param>
  <init-param>
  <param-name>detail</param-name>


  <param-value>3</param-value>
  </init-param>
  <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <jsp-config>
  <taglib>
  <taglib-uri>bean</taglib-uri>
  <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>html</taglib-uri>
  <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>logic</taglib-uri>
  <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>tiles</taglib-uri>
  <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  </taglib>

  </jsp-config>
</web-app>


struts-config.xml:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
  <data-sources />
  <form-beans >
  <form-bean name="msgForm" type="com.msg.struts.form.MsgForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
  <action
  attribute="msgForm"
  input="/msg.jsp"
  name="msgForm"
  path="/msg"
  scope="request"
  type="com.msg.struts.action.MsgAction"
  />

  </action-mappings>

  <message-resources parameter="com.msg.struts.ApplicationResources" />
</struts-config>






[解决办法]
19行改成 <html:form action="/msg"> 试试看
[解决办法]
<action-mappings > 
<action 
attribute="msgForm" 
input="/msg.jsp" 
name="msgForm" 
path="/msg" 
scope="request" 
type="com.msg.struts.action.MsgAction" 
/ > 
<html:form action="MsgAction.do" method="post" > 
这里的form action 对应于path中指定的路径,struts1.0中应该是path+.do的形式,所以
form action="/msg.do" 应该是这样才对,你试试看吧,不行在告诉我
[解决办法]
500错误肯定是你的程序错误了!
root cause

javax.servlet.ServletException: Cannot retrieve mapping for action /MsgAction
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) 
org.apache.jsp.msg_jsp._jspService(org.apache.jsp.msg_jsp:89) 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 


你看上面红色的错误!说百分之99的是你的映射错误!所以你应该就找找你跳转文件呀!
16: </head > 
17:
18: <body > 
19: <html:form action="MsgAction.do" method="post" > 
20: <table border="0" > 
21: <tr > 
22: <td >Title: </td > 
应该就差不多可以推出来是那个红色的部分错误呀!
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行