Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:56:48+00:00 2026-06-09T05:56:48+00:00

I apologize in advance for asking such a silly question, but I can’t seem

  • 0

I apologize in advance for asking such a silly question, but I can’t seem to get my Javascript to be executed. I switched from my complete page to a simple example to make sure I wasn’t doing anything too tricky, and I still can’t get the JS to work. I have the following code saved in a file named index.html on my server:

     <%@page import="index.jsp" %>
    <html>
        <head>
             <title>Hello World</title>
        </head>
        <body>
             Hello World!<br/>
             <script type="text/JavaScript" src="index.jsp">
             </script>
             Still hello world!
             <script type="text/JavaScript">
                 out.println(" Your IP address is " + request.getRemoteAddr());
                 alert("Welcome to the boost converter site");
             </script>
        </body>
    </html>

And what I see when I go to the page is :

 Hello World
 Still Hello World

In the Index.jsp file, I have:

 function InitPage(){
     out.println("Your IP address is " + request.getRemoteAddr());
 }

I know the solution is insanely simple, but I haven’t been able to come up with the line of code that fixes this. I’ve been copying example code over to my page just to see if somebody else’s JS is executed properly, and I haven’t gotten that either. Pretty sure the server runs Tomcat.

Thanks,

Craig

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:56:49+00:00Added an answer on June 9, 2026 at 5:56 am

    out.println() is Java / JSP, it is not Javascript.

    Try replacing it with document.write('Your IP address is unknown');

    <body>
        Hello World!<br/>
        <!-- Remove this. A .jsp is not Javascript. -->
        <!--script type="text/JavaScript" src="index.jsp">
        </script-->
        Still hello world!
        <script type="text/javascript">
            /* You can't use request.getRemoteAddr() in Javascript. It's Java. */
            document.write("Your IP address is unknown");//+ request.getRemoteAddr());
            alert("Welcome to the boost converter site");
        </script>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize in advance for asking such a stupid question, but how do I
I apologize in advance if I am asking asking question with impossible answer. But
I apologize in advance because this is somehow a silly question, but I just
I apologize in advance for a newbie question, but why do I get Access
I apologize in advance about asking a so similar question, but i'm rather frustrated,
I apologize in advance for the open-ended question. I tried searching, but wasn't sure
I apologize in advance for this somewhat ignorant question, but I have researched this
I apologize in advance if this is a newb question, but what are some
Apologies in advance for asking such stupid questions, but: In Workflow for creating AIR
I apologize in advance for asking this question, I know similar questions have already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.