Issue 799 in struts2-jquery: Jquery script is not working when the page is included in Struts2 tiles. But its functioning when I invoke the page directly

117 views
Skip to first unread message

struts2...@googlecode.com

unread,
Mar 26, 2012, 9:57:32 PM3/26/12
to struts2...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 799 by tis...@gmail.com: Jquery script is not working when the
page is included in Struts2 tiles. But its functioning when I invoke the
page directly
http://code.google.com/p/struts2-jquery/issues/detail?id=799

(This is for feature requests and bugs in Struts2 jQuery Plugin - for
getting help, please use the User Group.
http://groups.google.com/group/struts2-jquery )

What steps will reproduce the problem?
1. Code from my JSP.

File name: test.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<sj:head />

<s:url id="ajax" value="/exchangeRate.action">

</s:url>
<sj:div id="resultnormal" href="%{ajax}" indicator="indicator"
onBeforeTopics="beforeDiv" onCompleteTopics="completeDiv"
onErrorTopics="errorDiv"
cssClass="result ui-widget-content ui-corner-all">
Loading..
</sj:div>
<br /> <strong>Div with invalid URL:</strong>
<sj:div id="resulterror" href="/not_exist.html" indicator="indicator"
onCompleteTopics="completeDiv" onErrorTopics="errorDiv"
cssClass="result ui-widget-content ui-corner-all">
Loading
</sj:div>

2. Invoked test.jsp directly it worked fine.
3. I have included test.jsp in a tiles definition

<definition name="baseLayout" template="/pages/common/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="body" value="" />
<put-attribute name="header" value="/pages/common/test.jsp" />
</definition>

in web.xml

<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
<context-param>

<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>

4. Invoked by an action

What is the expected output? What do you see instead?

a. In div id "resultnormal" the result displayed but there was not Alert.
But Alert should come first and then the result.
b. in div id "resulterror" its still showing "loading" text. But
Expecting "Error request Not Found completed with error.
Status: 404"

Which struts2 version?
2.3.1.2

Which struts2-jquery plugin version?
3.3.0

Please provide any additional information below.

I also tried putting <sj:head/> on the basicLayout.jsp but still javascript
methods are not getting called when the page is part of a tiles definition.
It perfectly works fine when the page is invoked directly.

Please advice what's wrong with my settings..

struts2...@googlecode.com

unread,
Mar 26, 2012, 10:59:26 PM3/26/12
to struts2...@googlegroups.com

Comment #1 on issue 799 by tis...@gmail.com: Jquery script is not working
when the page is included in Struts2 tiles. But its functioning when I
invoke the page directly
http://code.google.com/p/struts2-jquery/issues/detail?id=799

Sorry I have missed the script to copy..

<script type="text/javascript">
$.subscribe('beforeDiv', function(event, data) {
alert('Before request ');
});
$.subscribe('completeDiv', function(event, data) {
if (event.originalEvent.status == "success") {
$('#resultnormal').append(
'<br/><br/><strong>Completed request '
+ event.originalEvent.request.statusText
+ ' completed with ' + event.originalEvent.status
+ '.</strong><br/>Status: '
+ event.originalEvent.request.status);
}
});
$.subscribe('errorDiv', function(event, data) {
$('#resulterror').html(
'<br/><br/><strong>Error request '
+ event.originalEvent.request.statusText
+ ' completed with ' + event.originalEvent.status
+ '.</strong><br/>Status: '
+ event.originalEvent.request.status);
});


$.subscribe('completediv2', function(event, data) {
alert(event.originalEvent.status);
setTimeout(function() {
$.publish('reloaddiv2');
}, 10000);

});
</script>

struts2...@googlecode.com

unread,
May 15, 2012, 11:01:07 AM5/15/12
to struts2...@googlegroups.com
Updates:
Owner: johgep
Labels: Component-Plugin

Comment #2 on issue 799 by johgep: Jquery script is not working when the
page is included in Struts2 tiles. But its functioning when I invoke the
page directly
http://code.google.com/p/struts2-jquery/issues/detail?id=799

Can you please prepare a simple tiles webapp and attach it here?

struts2...@googlecode.com

unread,
Sep 8, 2012, 1:06:19 AM9/8/12
to struts2...@googlegroups.com
Updates:
Status: Invalid

Comment #3 on issue 799 by johgep: Jquery script is not working when the
page is included in Struts2 tiles. But its functioning when I invoke the
page directly
http://code.google.com/p/struts2-jquery/issues/detail?id=799

I have a tiles app which is running fine with s2j plugin.

struts2...@googlecode.com

unread,
Mar 4, 2015, 8:07:50 AM3/4/15
to struts2...@googlegroups.com

Comment #4 on issue 799 by sergio...@gmail.com: Jquery script is not
working when the page is included in Struts2 tiles. But its functioning
when I invoke the page directly
https://code.google.com/p/struts2-jquery/issues/detail?id=799

johgep

I have the same problem:

The script:

<script type="text/javascript">
$.subscribe('onBeforeLoading', function(event,data) {
$(".ui-dialog-titlebar").hide();
$("#dialogCarregando").dialog('open');
});


$.subscribe('onCompleteLoading', function(event,data) {
$("#dialogCarregando").dialog('close');
});
</script>

The dialog:

<sj:dialog
id="dialogCarregando"
title=""
autoOpen="false"
modal="true"
resizable="false"
closeOnEscape="false"
>
<div>
<br/>
<br/>
<center><img id="indicatorLoading" src="<s:url
value="/images/indicator.gif" />" alt="Wait..." /> Wait a moment...</center>
</div>
</sj:dialog>

And the button:

<s:url
id="url_valida_login"
action="validaLoginResponsavel"
/>

<sj:submit
value="Login"
href="%{url_valida_login}"
button="true"
targets="divConteudo"
cssClass="btn btn-primary btn-lg"
onBeforeTopics="onBeforeLoading"
onCompleteTopics="onCompleteLoading"
/>

When I use tiles, dialog is not close after execute completeTopics.

Any idea ?

Sérgio

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Stanimir Marinov

unread,
Mar 6, 2015, 9:30:54 AM3/6/15
to struts2...@googlegroups.com, codesite...@google.com, struts2...@googlecode.com
I have strust2 tiles3 web app that working well with jquery plugin. JavaScript is interpreted from browser only. Try to view HTML and check generated from plugin JavaScript for the HTML entities.
Reply all
Reply to author
Forward
0 new messages