java - Strtus2 跳转到WEB-INF/content下
问题描述
使用strtus2,action进行跳转的时候,自动跳转到WEB-INF/content目录下。不知道哪里出问题了。
我是把所有的文件都放在了webroot下,
下面是我的几个文件
web.xml
<?xml version='1.0' encoding='UTF-8'?><web-app version='2.5' xmlns='http://java.sun.com/xml/ns/javaee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd'> <!-- 1. listener 2.Filter 3.servlet 4.welcome-file-list --> <!--========================== 1. 配置Spring========================== --> <context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext.xml</param-value> </context-param> <listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- ==========================配置struts2========================== --> <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></web-app>
applicationContext.xml
<?xml version='1.0' encoding='UTF-8'?><beans xmlns='http://www.springframework.org/schema/beans' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xmlns:p='http://www.springframework.org/schema/p' xmlns:aop='http://www.springframework.org/schema/aop'xmlns:context='http://www.springframework.org/schema/context' xmlns:jee='http://www.springframework.org/schema/jee'xmlns:tx='http://www.springframework.org/schema/tx'xsi:schemaLocation=' http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd'> <!-- ==================1.基于注解,扫描包============================= --> <context:component-scan base-package='com.demo.*'></context:component-scan> <!-- ==================2.数据源配置============================= --> <context:property-placeholder location='classpath:config/DBconfig.properties'/> <beanp:driverClassName='${driverClassName}' p:url='${url}' p:username='${username}' p:password='${password}' > </bean> <!--==================3.JdbcTemplate============================= --> <bean class='org.springframework.jdbc.core.JdbcTemplate'> <property name='dataSource' ref='dataSource'></property> </bean> <!-- ==================4.事务管理(AOP : Aspect Oriented Programming)============================= --> <!--(a) 配置事务对象: --> <bean class='org.springframework.jdbc.datasource.DataSourceTransactionManager'> <property name='dataSource' ref='dataSource'></property> </bean> <tx:annotation-driven transaction-manager='txManager'/> <!-- (b) AOP横切事务 --> <aop:config> <aop:pointcut expression='execution(* com.demo.dao..*.*(..))'/> <aop:advisor advice-ref='txAdvice' pointcut-ref='txPC'/> </aop:config> <!--(c) 事务属性定义--> <tx:advice transaction-manager='txManager'> <tx:attributes> <tx:method name='query*' read-only='true' /> <tx:method name='save*' propagation='REQUIRED' /> <tx:method name='add*' propagation='REQUIRED' /> <tx:method name='update*' propagation='REQUIRED' /> <tx:method name='delete*' propagation='REQUIRED' /> </tx:attributes> </tx:advice> </beans>
页面代码

问题解答
回答1:配置路径应该加上WEB-INF吧
回答2:已经解决了,原来是我action-->location中没有加“/”。相关文章:
1. angular.js - angular-ui-bootstrap 报错无法使用?2. 为什么span的color非要内联样式才起作用?3. javascript - swiper.js嵌套了swiper 初始设置不能向下一个滑动 结束后重新初始4. docker - 如何修改运行中容器的配置5. css - div设置float:left后高度设置自动会无效 ?6. 如何使用git对word文档进行版本控制?7. 在cmd下进入mysql数据库,可以输入中文,但是查看表信息,不显示中文,是怎么回事,怎新手,请老师8. html5 - H5做的手机分享页微信更新后,分享出去不再默认显示第一个图 作为缩略图9. 请问一下各位老鸟 我一直在学习独孤九贱 现在是在tp5 今天发现 这个系列视频没有实战10. 求救一下,用新版的phpstudy,数据库过段时间会消失是什么情况?

网公网安备