02-解决不能在web.xml中配置action问题

来源:互联网 发布:ansi标准c语言 编辑:程序博客网 时间:2024/06/10 12:00

问题产生的原因:

        比如咱们访问的一个网站,然后这个网站的欢迎界面是index.jsp

那么在web.xml中这样配置:

        <welcome-file-list>

                   <welcome-file>

                                  index.jsp

                    </welcome-file>

        </welcome-file-list>

但是在跳到这个index.jsp页面的同时,我们还需要通过一个Action从数据库中获取一些必要的数据,

如果在web.xml中这样配置:

        <welcome-file-list>

                   <welcome-file>

                                 xxxxxAction

                    </welcome-file>

        </welcome-file-list>

这样就会报错,原因是找不到这个配置的Action.


解决方法:

               1.欢迎页面写一个jump.jsp,用于跳转并请求一个Action

                <welcome-file-list>
        <welcome-file>jump.jsp</welcome-file>
        </welcome-file-list>

                2.然后在jump.jsp中加入下面这句话:

                   <meta http-equiv='refresh'  content='0;url=xxxAction'>


0 0
原创粉丝点击