Scriptaculous fails to load when java url rewriting is in place.
Reported by Peter Radkov | June 11th, 2008 @ 11:25 AM
The regular expression on line 48 and 50 in scriptaculous.js fail to match the schptaculous script tag when URL rewriting is in place. As a result the scriptaculous components - i.e. the additional js files don't load. The rexexp is currently (/scriptaculous\.js(\?.*)?$/). Here's a test file that illustrates the case: When the url of the js files is produced by the c:url tag and, as a result ;jsessionid is added at the end of the file name, the green div fails to appear and a js error is reported by the browser.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="sx" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fun..." prefix="fn" %>
<c:set value="<%=request.getContextPath()%>" var="CONTEXT_ROOT" scope="request"/>
<c:set value="${CONTEXT_ROOT}/script/scriptaculous-js-1.8.1/lib/prototype.js" var="PROTOTYPE_URL"/>
<c:set value="${CONTEXT_ROOT}/script/scriptaculous-js-1.8.1/src/scriptaculous.js?load=effects,controls" var="SCRIPTACULOUS_URL"/>
<!-- Toggle these to see the effect -->
<c:url value="/script/scriptaculous-js-1.8.1/lib/prototype.js" var="PROTOTYPE_URL"/>
<c:url value="/script/scriptaculous-js-1.8.1/src/scriptaculous.js" var="SCRIPTACULOUS_URL"/>
<!-- End toggle these to see the effect -->
<html>
<head>
<script type="text/javascript" src="${PROTOTYPE_URL}"> </script>
<script type="text/javascript" src="${SCRIPTACULOUS_URL}"> </script>
<title>Page title</title>
</head>
<body>
<div id="page_wrapper">
<div id="test_div"
style="width:100px; margin: 100px auto;
display: none; background-color: green; border: 1px solid black">
<table width="100%" style="height: 100px;">
<tr><td valign="middle" align="center">
Test!
</td></tr>
</table>
</div>
<script type="text/javascript">
new Effect.Appear("test_div");
</script>
</div>
</body>
</html>
Comments and changes to this ticket
-
Thomas Fuchs June 12th, 2008 @ 08:45 AM
- → State changed from new to invalid
This falls outside the domain of the loader. Either (monkey)patch the
scriptaculous.jsloader (not recommended), or load in the various.jsfiles you need from script.aculo.us manually:<c:url value="/script/scriptaculous-js-1.8.1/src/effects.js" var="SCRIPTACULOUS_URL"/> <c:url value="/script/scriptaculous-js-1.8.1/src/dragdrop.js" var="SCRIPTACULOUS_URL"/> <c:url value="/script/scriptaculous-js-1.8.1/src/controls.js" var="SCRIPTACULOUS_URL"/>
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
Source available from github
The Git repository resides at:
http://github.com/madrobby/scriptaculous
Check out the current development trunk with:
git clone git://github.com/madrobby/scriptaculous.git
As script.aculo.us 1.xx is feature-frozen, this development trunk is for bugfixes only.
New development should happen only for
script.aculo.us 2.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
