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

  • Home
  • SEARCH
  • 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 8776181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:59:24+00:00 2026-06-13T18:59:24+00:00

I am new to Javascript and Java Server Faces and I am having the

  • 0

I am new to Javascript and Java Server Faces and I am having the next Problem.

The Code below is working ok:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript">
        function initialize() 
        {
            alert("Testing");
        }
    </script>
    </head>
    <body onload="initialize()">

        <h1 align="center">Sol-Tech</h1><br  />

    </body>
</html>

But when I add a FOR loop, it doesn’t work:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript">
        function initialize() 
        {
            for(var i; i<3; i++)
            {
                alert("Test");  
            }
        }
    </script>
    </head>
    <body onload="initialize()">

        <h1 align="center">Sol-Tech</h1><br  />

    </body>
</html>

enter image description here

Has anyone any suggestion on how to perform a FOR loop in javascript without getting an error?

Thanks in advance,
Emanuel

  • 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-13T18:59:25+00:00Added an answer on June 13, 2026 at 6:59 pm

    You’re using an outdated version of Mojarra which exposes a bug wherein this kind of IllegalArgumentException: null source is incorrectly been thrown when the view file contains a XML syntax error or when the view couldn’t be restored. See also java.lang.IllegalArgumentException: null source and JSF issue 1762.

    If you upgrade to a newer Mojarra version (currently already 2.1.14), then you’ll in this particular case get a more self-explaining XML syntax error on the character < which indicates the start of a XML element. Facelets is namely a XML based view technology and parsed by a SAX parser. You’d need to replace the XML special character < by &lt;

    for(var i=0; i&lt;3; i++) {
        alert("Test");  
    }
    

    or to put the whole script in a CDATA block

    <script type="text/javascript">
      <![CDATA[
        function initialize() 
        {
            for(var i=0; i<3; i++)
            {
                alert("Test");  
            }
        }
      ]]>
    </script>
    

    or to just put it in its own .js file so that it won’t be parsed as XML.

    <script type="text/javascript" src="script.js"></script>
    

    See also:

    • Writing JavaScript for XHTML

    Unrelated to the concrete problem, the JS syntax error (uninitialized var i which I’ve already fixed in code snippets) is actually a completely different problem and would only show an error in client side in browser’s JS console and definitely not cause an exception in the server side as JS doesn’t run in webserver at all, but only in webbrowser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to both ruby and rails, but have experience with java, javascript and
I'm trying to build a simple HTTP Server using Java, using java.net.ServerSocket = new
I seem to be having trouble getting a 'proper' connection between my Java server
I'm building REST web app and my server side Java code expects request body
greetings, I'm new with java script so bear with me! I want to achieve
I am new in share point. I want to select data using java script
I'm relatively new javascript, but I am comfortable in other languages. I'm trying to
I'm using Nodejs and Socket.io. When the client connects, new JavaScript objects are created.
New to javascript and such, trying to create a loop for fading logos using
New to javascript, but I'm sure this is easy. Unfortunately, most of the google

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.