?
Solved

JavaScript link to JSP

Posted on 2003-03-24
4
Medium Priority
?
201 Views
Last Modified: 2010-04-01
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
Comment
Question by:worems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 150 total points
ID: 8196311
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
 

Author Comment

by:worems
ID: 8196446
But how do I generate the html file, as in the name of it?
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 8196467
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
 

Author Comment

by:worems
ID: 8196534
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question