wicket6.18获取相对路径
2015-02-12 17:44
232 查看
wicket6.18中想获取工程路径如下:
获取工程相对路径:
String contextPath = WebApplication.get().getServletContext().getContextPath();
或
String contextPath =RequestCycle.get().getRequest().getContextPath();
生成工程全路径:
RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(contextPath + "/images/0.gif"));
生成图片路径:
new Image("imgpath", new ContextRelativeResource("/images/0.gif");
获取工程相对路径:
String contextPath = WebApplication.get().getServletContext().getContextPath();
或
String contextPath =RequestCycle.get().getRequest().getContextPath();
生成工程全路径:
RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(contextPath + "/images/0.gif"));
生成图片路径:
new Image("imgpath", new ContextRelativeResource("/images/0.gif");
相关文章推荐
- 一个获取相对路径的方法(C#)
- 相对路径获取JAVA配置文件Class.getResourceAsStream() & ClassLoader的getResourceAsStream()
- 在JAVA文件中获取该项目的相对路径
- 怎样在JAVA文件中获取该项目的相对路径
- JavaScript打开窗口函数(Window.Open)使用详解、绝对路径与相对路径的获取与转换(含ASP.NET)
- 三种获取相对路径的方法
- 在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- 怎样在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- C# 中获取项目的相对路径
- 怎样在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- 在JAVA文件中获取该项目的相对路径
- [Java]JAVA获取相对路径问题的解决
- servlet/jsp 获取绝对路径和相对路径
- servlet/jsp 获取绝对路径和相对路径