Results 1 to 13 of 13

Thread: java app issues

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    java app issues

    I have this html page, and when I open it locally it works, but when I open it in the browser served by apache(working debian) it gives me these errors:

    [Fri Jan 23 08:32:00 2004] [error] (13)Permission denied: exec of /usr/share/XIII/example1.html failed
    [Fri Jan 23 08:32:00 2004] [error] [client 168.215.215.99] malformed header from script. Bad header=Launching... /usr/lib/apache-s: /usr/share/XIII/example1.html
    eduffield@develop:~$


    I tried this so far:
    sudo chmod +X gen_validation.js
    sudo chmod 777 gen_validation.js
    sudo chmod +X example1.html
    sudo chmod 777 example1.html

    Premissions:
    12 -rwxrwxrwx 1 office office 9282 Jan 23 08:35 gen_validation.js




    Code:
    <html>
    <head>
    	<title>An Example of using the general validation function </title>
    </head>
    <SCRIPT language="JavaScript1.2" src="gen_validation.js"></SCRIPT>
    <body>
    <P align=center>
    <SCRIPT language="JavaScript1.2">
    var arrFormValidation=
                 [
                       [//2343
    						  ["maxlen=25",
    		"First Name should be 25 characters max(Consider changing your Name !)"
    						  ],
    						  ["minlen=1",
    		"Please Enter your First Name ( Contact support if you don't have one! )"
    						  ],
    						  ["alpha",
    		"Only alphabetic characters expected in your First Name"
    						  ]
                       ],
                       [//234
    						  ["maxlen=25"],
    						  ["minlen=1"],
    						  ["alpha"]
                       ],
                       [//234
    						 ["maxlen=50"],
    						 ["minlen=1"],
    						 ["email"," Please enter the correct Email address"]
                        ],
                        [//234
    						  ["numeric"]
                        ],
                        [//234
    						  ["maxlen=500"]
                        ],
                        [//Country
    						 ["dontselect=0",
    		"Please Select your Country [ if you are not from Mars :) ]"
    						 ]
                        ]
                ];
    </SCRIPT>
    <form action="" onSubmit="return validateForm(this,arrFormValidation);">
    <table cellspacing="2" cellpadding="2" border="0">
    <tr>
        <td align="right">Frst Name</td>
        <td><input type="text" name="FName"></td>
    </tr>
    <tr>
        <td align="right">Eail</td>
        <td><input type="text" name="Email"></td>
    </tr>
    <tr>
        <td align="right">Lst Name</td>
        <td><input type="text" name="LastName"></td>
    </tr>
    <tr>
        <td align="right">Pone</td>
        <td><input type="text" name="Phone"></td>
    </tr>
    <tr>
        <td align="right">Adress</td>
        <td><textarea cols="20" rows="5" name="Address"></textarea></td>
    </tr>
    <tr>
        <td align="right">Country</td>
        <td>
    	   <SELECT name="Country">
    		<option value="" selected>[choose yours]
    		<option value="008">Albania
    		<option value="012">Algeria
    		<option value="016">American Samoa
    		<option value="020">Andorra
    		<option value="024">Angola
    		<option value="660">Anguilla
    		<option value="010">Antarctica
    		<option value="028">Antigua And Barbuda
    		<option value="032">Argentina
    		<option value="051">Armenia
    		<option value="533">Aruba	
    	  </SELECT>
    	</td>
    </tr>
    <tr>
        <td align="right"></td>
        <td><input type="submit" value="Submit"></td>
    </tr>
    </table>
    </form>
    </P>
    </body>
    </html>
    Last edited by Evan; Jan 23rd, 2004 at 10:50 AM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    You cant link to a JS file from perl I guess.. So you stick the JS in the header.

    I found this code that worked perfectly

    Code:
    <!-- TWO STEPS TO INSTALL BASIC VALIDATION:
    
      1.  Copy the coding into the HEAD of your HTML document
      2.  Add the last code into the BODY of your HTML document  -->
    
    <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
    
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original: wsabstract.com -->
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    function checkrequired(which) {
    var pass=true;
    if (document.images) {
    for (i=0;i<which.length;i++) {
    var tempobj=which.elements[i];
    if (tempobj.name.substring(0,8)=="required") {
    if (((tempobj.type=="text"||tempobj.type=="textarea")&&
    tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
    tempobj.selectedIndex==0)) {
    pass=false;
    break;
             }
          }
       }
    }
    if (!pass) {
    shortFieldName=tempobj.name.substring(8,30).toUpperCase();
    alert("Please make sure the "+shortFieldName+" field was properly completed.");
    return false;
    }
    else
    return true;
    }
    //  End -->
    </script>
    
    <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
    
    <center>
    <form onSubmit="return checkrequired(this)">
    
    <input type="text" name="requiredname">
    <br>
    <input type="text" name="requiredemail">
    <br>
    <select name="requiredhobby">
    <option selected>Pick an option!
    <option>1
    <option>2
    <option>3
    </select>
    <br>
    <textarea name="requiredcomments"></textarea>
    <br>
    <input type=submit value="Submit">
    </form>
    </center>
    
    <!-- The first option in your pulldown menus must be set to 'selected' !! -->
    
    <p><center>
    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    
    <!-- Script Size:  1.41 KB -->

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    1) This is a apparently a CGI question.
    2) Even if it were about JavaScript, it would not belong in the Java forum.

    3) You can't execute HTML as CGI. Or not that simple. But your specific problem might be solved by putting
    Code:
    Content-type: text/html
    at the top of your file. Note the extra newline, it's important.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    I thought it was a javascript error, because that is what it named at the problem in the error.log. thats why I put it here.

    Thanks.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, it calls it a "script error", nowhere does it say JavaScript. It just means that the server thinks there's an error in your CGI script, while in truth there is no CGI script, just a plain HTML file, which means that you have either renamed a html file to .cgi or you have some setup problem with your server.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    but see to fix the problem, all I had to do was put the JS file into the HTML file. So how do you account for that?

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Maybe it was the JavaScript file that was interpreted as CGI?

    No, apparently not.

    Anyway, JavaScript is executed on the client, so no JavaScript error will ever show up in your server logs.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    If the server cant get the correct premissions to even include a JS script it would show up in the error.log wouldnt it?

    [Fri Jan 23 08:32:00 2004] [error] (13)Permission denied: exec of /usr/share/XIII/example1.html failed
    [Fri Jan 23 08:32:00 2004] [error] [client 168.215.215.99] malformed header from script. Bad header=Launching... /usr/lib/apache-s: /usr/share/XIII/example1.html


    and it would only say Bad header=Launching... permission denied when the JS script was included.

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    [client 168.215.215.99] malformed header from script.
    This one's definitly a CGI error. The client complains to your server that the header sent by the CGI is invalid.

    At least that's what I think, I'd need the access to the server to experiment to be sure.

    Including a JavaScript file only requires read access, but the log entry says that it can't execute.

    Where exactly in your directory structure do these files reside, and can you post your server config?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    my dir structure is this


    XIII\ <-perl
    XIII\templates <-htm that feeds to perl

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    hmm thats interesting. maybe apache isnt setup to execute .JS, thats why it worked in the HTML file

  12. #12
    Addicted Member
    Join Date
    Sep 2002
    Location
    Durham, NC, US
    Posts
    218
    Some people just fail to get this:

    Java != JavaScript

    And CornedBee is right, this smells like a CGI problem, not a JavaScript problem. And you don't appear to have any Java within a 10 gig partition.

    Curse Netscape for renaming LiveScript and riding Sun's dusty coat tails. A PHB decision if there ever was one.
    Travis, Kung Foo Journeyman

    Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
    Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    OSS: Mozilla, MySQL (Manual)

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    heh. interesting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width