我正在创建一个jnlp
文件,但我需要接收一些网址参数。
我有一个方法可以捕获jsp
文件中的URL:
String getParameter (HttpServletRequest request, String param)
问题是如何将参数添加到jnlp
文件中:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" codebase="https://localhost:8443/java-web-start/test/" href="start.jnlp">
<information>
<title>TestApp</title>
<vendor>Oracle</vendor>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<java version="1.5+"/>
<jar href="start.jar" main="true"/>
</resources>
<application-desc main-class="com.Main"/>
</jnlp>
这是index.jsp
文件:
<%!
String getParameter(HttpServletRequest request, String param) {
String result = request.getParameter(param);
return result.replace("&", "&").replace("\"", """).replace("<", "<").replace(">", ">").replace("'","$#039;");
}
%>
<%=getParameter(request, "requestURL")%>
我希望在我的jnlp
文件中,然后下载并执行:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" codebase="https://localhost:8443/java-web-start/test/" href="start.jnlp">
<information>
<title>TestApp</title>
<vendor>Oracle</vendor>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<java version="1.5+"/>
<jar href="start.jar" main="true"/>
</resources>
<application-desc main-class="com.Main">
<argument><%= clientCount %></argument>
<argument><%=getParameter(request, "requestURL")%></argument>
</<application-desc>
</jnlp>