获取项目的各种路径



	@Action(name="FddSignatureAction_doAdd")
	@Result("/pages/com/zct/yfq/client/fddsignature/UploaddocsAction_goAdd.jsp")
	public String doAddFdd() {
		Map returnMap=new HashMap();
		try {
			//第一步个人CA证书申请接口
			
			HttpServletRequest  request = getRequest();
			String path = request.getContextPath();//项目名: /yfq-mgm
			String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //WEB路径:  http://127.0.0.1:8080/yfq-mgm/
			String URI = request.getRequestURI();//得到相对地址   /yfq-mgm/FddSignatureAction_doAdd.action
			String URL= request.getRequestURL().toString();//得到IE地址栏地址:  http://127.0.0.1:8080/yfq-mgm/FddSignatureAction_doAdd.action
			String classPath = zxdTest.class.getClassLoader().getResource("/").getPath();//    /D:/YFQ/code/java/yfq-mgm/bin/classes/
			String servletPath =request.getServletPath();//    /FddSignatureAction_doAdd.action
			String temp=request.getRealPath("/"); //         D:\YFQ\code\java\yfq-mgm\src\main\webapp\
			String RealPath =request.getRealPath("UploaddocsAction_goAdd.jsp"); //  D:\YFQ\code\java\yfq-mgm\src\main\webapp\UploaddocsAction_goAdd.jsp
			String path2=request.getSession().getServletContext().getRealPath("/");

猜你喜欢

转载自zhang1989101.iteye.com/blog/2328989