初涉配置struts
来源:互联网 发布:淘宝分销和代销的区别 编辑:程序博客网 时间:2024/06/05 11:23
暂时使用这些基本jar包
如此结构
web.xml好配置
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><!-- 配置核心拦截器 --><filter> <!-- Filter的名字 --> <filter-name>struts2</filter-name> <!-- Filter的实现类 struts2.5以前可能有所不同 --> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>//这里主要2.5以后少了.ng包</filter><filter-mapping> <filter-name>struts2</filter-name> <!-- 拦截所有的url --> <url-pattern>/*</url-pattern></filter-mapping></web-app>struts.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <!-- name action的名字,访问时使用helloworld.action访问,class:实现类 --> <action name="index" > <!-- 结果集,即action中SUCCESS返回的视图 --> <result> /index.jsp </result> </action> </package> </struts>index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!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>Action Result</title> </head> <body> <h1>配置好基本的struts2环境</h1> </body> </html>run index.jsp
在浏览器URL: http://localhost:8080/struts01/index.action
成功跳转
出现问题应该都是web.xml或struts.xml问题,好像无其他配置关系
阅读全文
0 0
- 初涉配置struts
- struts学习---配置struts
- struts-配置struts
- struts配置
- Struts配置
- struts配置
- Struts配置
- 配置struts
- struts配置
- 配置Struts
- Struts配置
- struts 配置
- struts配置
- struts配置
- struts配置
- 配置Struts
- struts 配置
- 配置Struts
- javaweb注意点
- 数据库索引到底是什么,是怎样工作的?
- 文章标题
- 第一讲 Hello FreeMarker
- 欢迎使用CSDN-markdown编辑器
- 初涉配置struts
- 向量容器vector模板
- pandas中apply筛选数据
- Kali渗透测试——快速查找Metasploit的模块
- 二分搜索——34. Search for a Range
- Android笔记(100)通知流程
- world final2017-E 二分
- maven仓库快速镜像
- 数据库实验一( 表、视图和索引的管理 )