Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

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.

You can Add a comment or ranking to this page

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