I have a working myfaces application working inside websphere portal 5.1. I thought it would be cool if I ajaxized my portlet with dojo. This way I don't suffer from the entire page refresh which in a portal can be expensive.
So I overwrote the myfaces renderer for forms. My new form renderer adds one thing, an onsubmit value of 'return dojoSubmit(this);' what dojoSubmit does is this function dojoSubmit(form) { dojo.require("dojo.io.*"); dojo.io.bind({ url: form.action, load: function(type, evaldObj) { marker = "<span id=\"pageId\">"; startI = evaldObj.indexOf(marker); start = evaldObj.substring(startI + marker.length); endI = start.indexOf("</span><!--end-->"); page = start.substring(0, endI); document.getElementById("pageId").innerHTML=page; }, formNode: form, mimetype: "text/plain", // get plain text, don't eval() transport: "XMLHTTPTransport" }); return false; } So in a nutshell I am rerouting the form submission to use ajax and updating the content of a predetermined span with encapsulates the page. Pardon the viscious hack of the portal response using indexOf and substring. Anyway, this works as intended. The span gets updated with the correct html and it looks far better than an entire page refresh. My problem is that setting the innerHtml does not seem to be reinterpreting embedded javascript and stylesheet references. innerHtml was the easiest way to accomplish what I wanted, I don't argue it may not be the best. Can anyone help explain to me why if my new html content has <script src="x"></script> that script will not be interpreted using innerHtml? If the page is refreshed entirely everything (the javascript, stylesheets) work fine. It just seems to be a problem when I use innerHtml. Thanks, Ryan