Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF 2.0.1 + j:ajax + inline <script>

843844Oct 27 2009 — edited Oct 28 2009
Hi,
I am having problems with using inline <script> code in a .xhtml pages when using <j:ajax> in the page which forwarded the client's browser to the new page.

index.xhtml:
<h:form prependId="false">
..
<h:commandButton value="Connect" action="#{mybean.connect}">
<f:ajax ...>
</h:commandButton>
..
</h:form>

Then the client gets forwarded ( the connect method of Mybean returned "connected")

connected.xhtml:
<f:verbatim>
<style type="text/css">
.ui-widget-content { margin: 0 1em 1em 0; padding: 0.4em; }
.ui-widget-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
</style>
<script type="text/javascript">
$(function() {
$("#panelFilterList").resizable({
});
});
</script>
</f:verbatim>

The problem is that the <script> part of the page connected.xhtml is not "executed" on the client side. On the other hand, the <style> part is successfully rendered.

When removing the "<f:ajax ...>" code from the page index.xhtml, then the javascript code is executed on connected.xhtml.

I've read the post which I think is related to my issue: http://www.jroller.com/HazemBlog/entry/jsf_2_0_ajax_problem
Jim Driscoll says in the comment that it has been fixed.

Does anyone know how to have the client to actually execute the javascript code in the second page?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2009
Added on Oct 27 2009
6 comments
713 views