2 回答
TA贡献1863条经验 获得超2个赞
这真的很痛苦。桌面.浏览不适用于锚点,如这里所讨论的:如何从Java启动带有锚点的文件协议URL?该链接提供了窗口的可能解决方法。
使用Linux,您可以通过执行以下命令来打开网址:
Runtime.exec("open file:/D:/app/wildfly-13.0.0.Final/standalone/tmp/vfs/deployment/deployment545477ea955f6f3d/mainUI-1.2.14.0.war-7f1f239336b4e258/documentation/index.htm#_Toc502051959");
TA贡献1784条经验 获得超2个赞
解决我的问题,如果突然有人遇到同样的问题:
String menuNameNotBlanked = menuName == null ? "" : menuName.replace(" ","_");
String formPathNotBlanked = formPath == null ? "" : formPath.replace(".xhtml","").replace("/","_");
String helpPath = ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath(HELP_FILE_PATH);
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
URL contextURL = new URL(request.getScheme(),request.getServerName(),request.getServerPort(),request.getContextPath());
URL helpURL = new URL(contextURL.toString()+ "/" + HELP_FILE_PATH + AddLeadString(menuNameNotBlanked+formPathNotBlanked,"#"));
RequestContext.getCurrentInstance().execute("window.open('" + helpURL + "')");
添加回答
举报