Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

JSP & JavaScript

can I have server-side includes in my script?



6:10 pm on Apr 23, 2002 (gmt 0)

I want to:

-use JavaScript to change the innerHTML of a div

-not have to have many lengthy strings in my JS

Can I just have the strings be external files included via JSP? For example, something that looks like:

function displayDetails ( topic ) {

document.dynamicDiv.innerHTML = "<%@include file="/include/" + topic + ".jsp %>";



6:55 pm on Apr 23, 2002 (gmt 0)

uh, OK -- don't think it'll work. tried a buncha variations, but I think that no matter what, the server will need to process it again....


7:11 pm on Apr 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Include files (asp, jsp etc) are included on the server side (when the file is requested). All the client (browser) sees is the content of your includes in the place where your include tags where. View your source through the browser and you'll see what I mean.


7:12 pm on Apr 23, 2002 (gmt 0)

yeah, I know -- I be down wid the server-side includes. I was just being dumb. :)

Featured Threads

Hot Threads This Week

Hot Threads This Month