首页指向一个action,在这个action中读取数据库,然后由这个action掉转到index.jsp上

解决方案 »

  1.   

    能提供一些配置方式或代码吗?
    比如如何指向action,index.jsp中如何写程序读数据
      

  2.   

    比如说:你在访问的时候输入http://xxx.xxx.xxx.x:8011/ProjectName/index.do这时候就可访问你的INDEX.DO了. 当然,肯定要在你的STRUTS-CONFIG.XML中配置啊.
      

  3.   

    是的,刚接触struts,但急需解决这问题
      

  4.   

    今天是来送分了是想能够直接用http://xxx.xxx.xxx.x:8011/ProjectName/就能访问,欢迎页设index.do好像不行
      

  5.   

    <welcome-file-list>
    <welcome-file>index.do</welcome-file>
    </welcome-file-list>
      

  6.   

    楼上的我这样设不行struts_config.xml里也有
    <action-mappings >
        <action
          path="/index"
          scope="request"
          type="com.chuzuwu.struts.action.IndexAction" />  </action-mappings>IndexAction的execute()也设转到index.jsp文件(此文件存在),但还是提示404找不到文件
      

  7.   

    我使用的方法是首页默认是index.html。然后他的功能就是指向index.jsp所需要的action
      

  8.   

    也可以让你的首页是一个SERVLET.做完工作之后跳到你的INDEX.JSP
      

  9.   

    我知道可以用servlet做,但不就是想用struts吗,突然发现这玩意做不了,郁闷,做过的人指导一下
      

  10.   

    你先在welcome-file中设置一个index.html文件,在这个文件中什么内容都没有,只要添加下面的话:
    <body onload="window.location.href='/index.do'">
    </body>这样就能直接转向index.do了,然后index.do中读取数据库,处理完之后页面跳转到index.jsp现实结果
      

  11.   

    首页 必须事先走 index.do  
    web.xml  要有 *.do
    struts_config.xml 里
    <action-mappings   > 
            <action 
                path="/index" 
                scope="request" 
                type="com.chuzuwu.struts.action.IndexAction"> <forward name="index"  path="/common/index.jsp"/>
       </action>
        </action-mappings> action 类 里面 
    return mapping.findForward("index");