Training, Open Source computer languages

This is page http://www.wellho.net/forum/The-Java ... guage/Embedd-js-files-in-Perl-n-execute-in-Tomcat.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Embedd .js files in Perl n execute in Tomcat

Posted by v.akshatha.hegde (v.akshatha.hegde), 23 May 2007
Hi,

I managed to execute a perl program using Apache Tomcat. But if I include some img file or JavaScript file in my perl program the server is not able to locate my img or .js file. Could any one you tell me where to place my img or .js file for the server to interpret while executing a perl program in Tomcat.

Since I am new to this forum I do not know if this is the relevant component.Please tell me if this is a wrong component as this is really urgent for me.

Any help would be appreciated.

My code is here: hello2.pl

#!/usr/bin/perl
print "Content-Type: text/html\n\n";


print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Experiments with JavaScript : First Page</TITLE>\n";

print "<script language='javascript' src='greet.js'>\n";
print "</script>\n";

print "</HEAD>\n";

print "<BODY>\n";
print "<H1>My First JavaScript Programs</H1>\n";
print "<P>\n";
print "This page will eventually contain a few of my JavaScript experiments.\n";

print "</p>\n";
print "</BODY>\n";
print "</HTML>\n";


greet.js

alert("Welcome to my page!!!!!!!!1.");

and I have placed my js file in the same place as that of perl file. Plzzzzzzzz help!



Thanks,
Akshatha

Posted by admin (Graham Ellis), 23 May 2007
As you are generating your HTML through the cgi directory - a directory of scripts - you will need to specify a different directory in the HTML you sent out , in "server absolute", and place the extra files there.

For example,
print "<script language='javascript' src='greet.js'>\n";
becomes
print "<script language='javascript' src='/greet.js'>\n";

and the greet.js file goes in the root directory of the web site

Posted by v.akshatha.hegde (v.akshatha.hegde), 24 May 2007
Hi Graham,

Thanks a lot for the Quick help. It works  .

Cheers,
Akshatha



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho