• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

JavaScript link to JSP

I want to generate a html file with javaScript in it from JSP, does anybody know how to do this? I also want the parameters passed through to that page. Thanks
0
worems
Asked:
worems
  • 2
  • 2
1 Solution
 
cheekycjCommented:
just generate the HTML like so:

<%
  String param1 = request.getParameter("param1");
  String param2 = request.getParameter("param2");
  String param3 = request.getParameter("param3");
%>

<script>
var jsvar1 = <%=param1%>
var jsvar2 = <%=param2%>
var jsvar3 = <%=param3%>

</script>

html here...

HTH,
CJ
0
 
woremsAuthor Commented:
But how do I generate the html file, as in the name of it?
0
 
cheekycjCommented:
If you want to create a brand new HTML file you need to use java.io.File API.  If you want the JSP to generate the HTML as it is loaded.. then the name of the HTML file is the JSP file itself.

CJ
0
 
woremsAuthor Commented:
thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now