My 2001 Ford Focus judders when idle, and is most seen under load. The rev counter goes from roughly 500rpm to 1500rpm during this juddering cycle, as if it is "hunting" for the correct place to be.

When the lights are on, they noticeably dim during this time - which lasts for about 2 seconds, every 15 to 20 seconds. 

The alternator is the likely culprit, however this was replaced two years ago and the battery is still being charged.

This behavior is most noticeable under electrical load, but also happens when the lights are off. This behavior is intermittent, and does not occur when the car is in motion - only when idling.

So, is the alternator the culprit, or is there something else which may be causing this?


Question: struts2+spring3: passing a variable from action to jsp (javascript code)
Answer: For web development starters, it's important to understand that server side languages like JSP runs on webserver and client side languages like JS runs on webbrowser. JS does not run in sync with JSP. JSP only produces HTML/CSS/JS code. Webserver sends it to webbrowser. JS only sees/understands HTML.

Whenever you want to assign JSP variables to JS, you need to let JSP print it as if it is JS code. Here's an example with JSTL &lt;c:forEach&gt; tag to iterate over Object[][] (I believe Struts has also its own iterator tag, &lt;s:iterator&gt;, but since I don't use Struts, I'm not sure how to use it and if it is applicable; JSTL should work as good).

&lt;script&gt;
    var objects = [];

    &lt;c:forEach items="${objects}" var="row" varStatus="x"&gt;
        objects[${x.index}] = [];
        &lt;c:forEach items="${row}" var="column" varStatus="y"&gt;
            objects[${x.index}][${y.index}] = '${column}';
        &lt;/c:forEach&gt;
    &lt;/c:forEach&gt;
&lt;/script&gt;


This way it'll end up as follows when JSP has done its task of producing HTML/JS code, assuming that you have an Object[][] with 2 rows and 2 cols (you can verify it yourself by opening page in webbrowser, rightclicking it and choosing View Source):

&lt;script&gt;
    var objects = [];
    objects[0] = [];
    objects[0][0] = 'row1col1';
    objects[0][1] = 'row1col2';
    objects[1] = [];
    objects[1][0] = 'row2col1';
    objects[1][1] = 'row2col2';
&lt;/script&gt;


This way JS code can access it by objects.