大家好, 我现在做好了一个JSP页面,但是他上面的包太多,访问时要写一大串路径如:http://localhost:8888/pms/pages/vehicle/index/index.jsp,有没有一种方法让我在访问这个JSP时不要写那么多路径如:http://localhost:8888/pms/pages/index.jsp,有没有这样的技术了? 谢谢
我用的是struts2 + spring +hibernate写的
我用的是struts2 + spring +hibernate写的
解决方案 »
- 为什么Cookie里面键对应的值不能放文字?
- 寻JAVA WEB开发高手,帮解决一个问题,详看描述
- Apache, Struts2, OpenSymphony是什么关系?
- 新手:client/server用数据报传送一个文件?~
- 有关struts的地址跳转的问题
- 求比较简单思路
- 如何在jsp页面上点击一个按钮或图像生成一个对话框,并且对话框可以生成动态树和文本框?求救!
- 请问JSP是否有类似ASP的global.asa 文件?
- ENCTYPE="multipart/form-data时,得到aaa的值是null,怎么办?
- 谁了解流媒体?如ntsp等???
- jacob操作excel打印问题
- 奇怪问题,望各位能够帮我解决
网址在:http://tuckey.org/urlrewrite/
例如定义一个action的namaspac为/
成功结果页为http://localhost:8888/pms/pages/vehicle/index/index.jsp
直接用http://localhost:8888/pms/xxx.action访问就行了
自动转到 http://localhost:8888/pms/pages/vehicle/index/index.jsp
思路这样:
建一个Servlet在doGet中接收参数 go RequestDispatcher dispatcher = null;
String param = request.getPrameter("go");
if(param == null)
thorw new ServletException("Missing parameter.");
else if(param.equals("index")) {
dispatcher = request.getDispatcher("/pms/pages/vehicle/index/index.jsp");
}
....加入你要的其他路径
if(dispatcher != null) {
dispatcher.forward(request, response);
}
else
throw new ServletException("null dispatcher.");个人想法希望对你有帮助.
<welcome-file>vehicle/index/index.jsp</welcome-file>
</welcome-file-list>
访问时用http://localhost:8888/pms/pages
还有楼主可以说说,这么做具体要实现什么样的功能,针对不同的情况,处理的
方式也是不一样的
<action name="**" class="cms.cmsPage" method="{1}">
<result name="yes" type="dispatcher">${path}</result>
<result name="action" type="chain">
<param name="namespace">${namespace}</param>
<param name="actionName">${actionName}</param>
</result>
</action>
path namespace actionName都可以在action中配置 当然你的提议只设置path就可以了