jsp implementation Click help to open the chm file
- 2020-12-05 17:19:54
- OfStack
Description of handling problems: Now I have an javaweb project. I need to click help on portal to open the "help.chm" file.
At present, there is no similar case in Search Baidu, so I have come up with a way to realize it through jsp:
jsp main interface file
<a href="#" onclick="javascript:$.getJSON('<%=path %>/admin/openYACShelp.jsp?req='+new Date(),function(json) {});"
id="openYACShelp"> help </a>
openYACShelp jsp file
<%
String ch1="/";
String ch2="//";
String contextPath = System.getProperty("user.dir");
String helpFilePath = contextPath + "/yacs/ help .chm";
Runtime.getRuntime().exec("hh.exe "+helpFilePath.replaceAll(ch1,ch2)); %>