开发者社区> 问答> 正文

web在eclipse中运行不了是为什么

代码如下:

web.xml 

<?xml version="1.0" encoding="UTF-8"?>
 <web-app id="WebApp_9" version="2.4"
 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">
 <filter>
  <filter-name>struts2</filter-name>
     <filter-class>org.apache.struts2.dispatcher.ng.filter.
     StrutsPrepareAndExecuteFilter</filter-class>
 </filter> 

<filter-mapping>
  <filter-name>struts2</filter-name>
   <url-pattern>/*</url-pattern>
 </filter-mapping>
 <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
 <error-page>
  <error-code>404</error-code>
  <location>/error.jsp</location>
 </error-page>
 </web-app> 

index.jsp 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<s:a action="hello">hello</s:a>
</body>
</html> 
  

error.jsp 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="s" uri="/struts-tags" %>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
 <center>
 <h4>the page you request is not existing!</h4>
 </center>
</body>
</html> 

最后运行中出现了这句话The tag handler class for "s:a" (org.apache.struts2.views.jsp.ui.AnchorTag) was not found on the Java
Build Path

展开
收起
爵霸 2016-06-02 10:08:02 2347 0
1 条回答
写回答
取消 提交回答
  • localhost-config找不到,在window--->preferences里面找到tomcat 重新配置一下(tomcat有可能在server下面)
    

    答案来源网络,供参考,希望帮助到您

    2019-10-10 11:48:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Web应用系统性能优化 立即下载
高性能Web架构之缓存体系 立即下载
PWA:移动Web的现在与未来 立即下载

相关镜像