急, struts项目 想配置index.do为首页面 怎么配置? 不能转发! <welcome-file-list> <welcome-file>/index.do</welcome-file></welcome-file-list>加个/试试 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <welcome-file-list> <welcome-file>/index.do</welcome-file></welcome-file-list>index.do改成/index.jsp lip009(深蓝忧郁) 加了, 不行。whzresponse() , 我想让index.do变成默认页。 .do呀,是不是应该是.jsp呀,index.do是一个action吗? 是啊 你首页应该是直接转过去 不需要执行逻辑操作的index.do是一个动作,需要逻辑实现的!你还要写相关的逻辑后才会转到对应的页面!你直接定制到index.jsp不好么? 当然不行了, 我必须先要到index.do进行数据库得操作, 把数据取出来, 然后才能转到jsp页面, 显示这些数据, 要不我直接到jsp页面, 什么都没有啊!!不能用转发, 这样google或者baidu得搜索鄞型根本不收录这个网站。 改你的WEB服务器的默认首页设置 不能用转发, 这样google或者baidu得搜索鄞型根本不收录这个网站。//确信? 当然不行了, 我必须先要到index.do进行数据库得操作, 把数据取出来, 然后才能转到jsp页面, 显示这些数据, 要不我直接到jsp页面, 什么都没有啊!!你直接进入jsp也可以有数据阿!你在jsp页面直接调用javabean操作数据不就行了! 你用userBean去调用数据库不就的了! 如果不行,就只能在JSP页面中来进行数据库操作和数据显示了 只能用转发,因为<welcome-file-list> <welcome-file>index.do</welcome-file></welcome-file-list>里要求必须是一个有效的物理文件地址 你的index.do是直接写的吗?要是这样的话应该是不行吧,你要是想页面初始化的话应该用一个自定义标签,否则不能初始化,也就是说你的让页面加载之前先去执行一下你的数据库查询。 <welcome-file-list> <welcome-file>index.jsp</welcome-file></welcome-file-list>换成index.jsp然后在index.jsp里<jsp:include page="index.do"/>把.do包含进来或者在index.jsp里写个转发请求<% response.sendRedirect("/index.do");%> 结贴吧, 我用得struts, 在页面用useBean就违背了struts得原则了, struts真不好用!!!垃圾东西!!!用转发得, google baidu根本不认你这个页面。 .do应该是不行的,你想用一个Action作为首页,怎么可以?Action最后不是也要通过forward转到一个.jsp上吗? ? <welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>换成index.jsp然后在index.jsp里<jsp:include page="index.do"/>把.do包含进来或者在index.jsp里写个转发请求<%response.sendRedirect("/index.do");%> 当然不行了, 我必须先要到index.do进行数据库得操作, 把数据取出来, 然后才能转到jsp页面, 显示这些数据, 要不我直接到jsp页面, 什么都没有啊!!===========================================================你可以单独用个servlet来加载数据放在servletContext里面的啊,只要把这个servlet的load-on-startup设置的比ActionServlet的load-on-startup小就行了嘛 大哥,你就非得用action??servlet不能完成你的需求???不能吧 楼上不是有人说了吗web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。web服务器的配置要改 。。 you can't do as that!你应该这样做:<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"><web-app> <servlet> <servlet-name>action</servlet-name> <servlet-class> org.apache.struts.action.ActionServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </web-app>然后在配置好struts-config.xml 建立jsp页面 在里面实现自动跳转到.do不行吗/就是访问jsp然后相当于访问.do 你有没有杂在struts-config.xml中培植/index的请求路径啊?类似下面的:<action path="/index" type="com.xxx.AdminAction" scope="request" name="loginForm" input="/error.jsp" validate="true"> <forward name="success" path="/welcome.jsp" /> <forward name="failure" path="/failure.jsp /> </action> 不能把.do 设置啊。只能设置.jsp 写一个servlet,在这之前调用(设定 load-on-startup为1),把预处理工作做完。 同意lip009(深蓝忧郁)的方法,如果你想显得更像struts,可以用<tiles:insert page="/index.do" flush="true"/> 急!!! maven编译错误:找不到符号 一个文件上传问题 tomcat+eclipse+struts2结构,为公司做项目,好心人进来看看吧。新手啊! 自己写的jar包,怎么加密,请各位帮帮忙 获取特定字符串之间的值 SSH 菜鸟 检索用户信息出错,分不多,还请费心了! J2EE高手进 ant 文件编写,大家过来看看吧 请教关于hibernate 3.0 的初始化报错java.lang.ClassCastException: myeclipse怎么配置jboss Digester组件的使用 jboss4下如何部署 web程序?
<welcome-file>/index.do</welcome-file>
</welcome-file-list>
index.do改成/index.jsp
index.do是一个动作,需要逻辑实现的!你还要写相关的逻辑后才会转到对应的页面!
你直接定制到index.jsp不好么?
你在jsp页面直接调用javabean操作数据不就行了!
<welcome-file-list>
<welcome-file>index.do</welcome-file>
</welcome-file-list>
里要求必须是一个有效的物理文件地址
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
换成index.jsp
然后在index.jsp里<jsp:include page="index.do"/>把.do包含进来或者在index.jsp里写个转发请求
<%
response.sendRedirect("/index.do");
%>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
换成index.jsp
然后在index.jsp里<jsp:include page="index.do"/>把.do包含进来或者在index.jsp里写个转发请求
<%
response.sendRedirect("/index.do");
%>
===========================================================
你可以单独用个servlet来加载数据放在servletContext里面的啊,只要把这个servlet的load-on-startup设置的比ActionServlet的load-on-startup小就行了嘛
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
web服务器的配置要改 。。
你应该这样做:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"><web-app> <servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>然后在配置好struts-config.xml
<action path="/index"
type="com.xxx.AdminAction"
scope="request"
name="loginForm"
input="/error.jsp"
validate="true">
<forward name="success" path="/welcome.jsp" />
<forward name="failure" path="/failure.jsp />
</action>