比如我服务器一启动就进入首页,比如一些新闻之类的,不需要提交从action里读数据或者有人说可以在web.xml配置<listener>,怎么用啊?

解决方案 »

  1.   

    进入首页你可以默认进入index.jsp 然后页面转发给action后再跳转到另外一个jsp视图 <jsp:forward page="${ctx}/index.action"></jsp:forward>
      

  2.   

    <listener>
      <listener-class>.....</listener-class>
    </listener>public class InitParamListener implements ServletContextListener{
            // context初始化时激发
    public void contextInitialized(ServletContextEvent event) { //初始化代码
    }
    }
      

  3.   

    直接在JSP页面使用<s:action/>标签,在对应的action里定义一个属性接收,
    页面访问接收了结果的属性,当然.要在<s:action/>标签后访问.
      

  4.   

    JQuery 会不?  JS ? 可以写个 onload 事件撒。在开发 JSP 中 最好+ 上 listener
    <listener>
      <listener-class>
         org.springframework.web.context.ContextLoaderListener
      </listener-class>
    </listener>
      

  5.   


    使用listener后怎么在页面里调用?