struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francisco Exposito <fcoexpos...@hotmail.com>
Subject RE: Sorting with displaytag issue due to theme="ajax"
Date Wed, 10 Sep 2008 11:58:32 GMT

Dave, I'm lost... I don't see any difference but the ajax (between two executions I only change
the struts.xml file). I'll try to explain again and please, if after my explanation you think
there are too much differences, please tell me which differences do you see. But I think I've
isolated all I can the issue...

I have the new menu modified deleting the s:div:

<%@ page pageEncoding="ISO-8859-1" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
    <head>
        <script language='javascript' src="src/javascript/jquery.js" type="text/javascript"></script>
        <script src="src/javascript/displayTagAjax.js"></script>
        <s:head theme="ajax"/>
        <link rel="stylesheet" media="all" type="text/css" href="src/css/default.css" />

    </head>
    
    <body>  
    
      <div id="divPagina">
            <s:url id="buscarUsuario" action='IrBuscarUsuario'/>
            
            <div id="divMenu">
                
                <ul id="menu">
                    <li class="sub">Usuarios
                            <ul>
                                <li><s:a id="linkBuscarUsuario"
                                         theme="ajax"
                                         href="%{buscarUsuario}"
                                         targets="divContenedor"
                                         showLoadingText="false">Buscar usuario</s:a></li>
                            </ul>
                    </li>         
                </ul>
            </div>
            <s:div id="divContenedor" theme="ajax">
            </s:div>
        </div>  
    </body>
</html>

When I open the menu, the results page with the display tag must be loaded in the divContenedor
defined in the menu page. The results page is:

<%@ page import="ads.web.action.UsuarioAction"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<%
  Object result = session.getAttribute( "result" );
  UsuarioAction ac = new UsuarioAction();
  System.out.println(ac.getTodosUsuarios());
  session.setAttribute( "result", ac.getTodosUsuarios() );
%>
<html>
    <head>
    
        <script language='javascript' src="src/javascript/jquery.js" type="text/javascript"></script>
        <script src="src/javascript/displayTagAjax.js"></script>
        <s:head theme="ajax" debug="true"/>
    </head>
    <body>
        <div id="ajxDspId">  
            <display:table name="sessionScope.result" pagesize="2"  htmlId="dispTable"
sort="list">
                <display:column property="idUsuario" title="ID" />
                <display:column property="nombre" sortable="true"/>
                <display:column property="mail" sortable="true"/>
                
              </display:table>        
         </div>
    </body>
</html>

The unique thing I change between the two examples is the struts-xml file:

a) First execution:

<action name="Login" class="ads.web.action.LoginAction">
            <result name="success_usuario_adsAdmin">/src/jsp/results.jsp</result>
 </action>

When I login, the results page appear, the script displayTagAjax.js is executed, the references
are updated and all work properly.

b) Second execution:

<action name="Login" class="ads.web.action.LoginAction">

            <result name="success_usuario_adsAdmin">/src/jsp/menu.jsp</result>

 </action>


When I login, the menu appears and then I click on "Buscar usuario". Then the
page with the results is loaded in the divContenedor. The script displayTagAjax.js is executed
when I load the menu, but not when the results page is loaded. Therefore the hrefs are not
modified and the ajax in displaytag doesn't work.

I hope I've explained better -if you have patient to read all this :)





> Date: Wed, 10 Sep 2008 04:14:27 -0700
> From: newton.dave@yahoo.com
> Subject: RE: Sorting with displaytag issue due to theme="ajax"
> To: user@struts.apache.org
> 
> --- On Wed, 9/10/08, Francisco Expositowrote:
> > The unique difference I see is that the correct one
> > doesn't use ajax, isn't it?
> 
> There's a huge number of differences between the two examples. That's not how you isolate
a problem.
> 
> The advice I provided stands; and I'd still remove the <s:div...> tags if you're
not using their Ajax functionality.
> 
> Dave
> 
> > 
> > 
> > 
> > > Date: Wed, 10 Sep 2008 03:37:30 -0700
> > > From: newton.dave@yahoo.com
> > > Subject: RE: Sorting with displaytag issue due to
> > theme="ajax"
> > > To: user@struts.apache.org
> > > 
> > > There are too many differences between your two
> > examples. You should build up the functionality from one to
> > another until it breaks and start from there.
> > > 
> > > One thing I'd comment is that if your divs are
> > just containers then don't use the <s:div...> tag,
> > as with the ajax theme they're really designed for
> > something else--just use HTML divs. I'd try that first,
> > then start to isolate the problem one step at a time.
> > > 
> > > Dave
> > > 
> > > --- On Wed, 9/10/08, Francisco Exposito wrote:
> > > > I've changed the order and now that error
> > doesn't
> > > > appear, but it doesn't work yet...
> > > >  
> > > > I have done a test with this page:
> > > >  
> > > > <%@ page
> > > >
> > import="ads.web.action.UsuarioAction"%>
> > > > <%@ taglib
> > uri="http://displaytag.sf.net"
> > > > prefix="display" %>
> > > > 
> > > > <%
> > > > Object result = session.getAttribute(
> > "result" );
> > > > UsuarioAction ac = new UsuarioAction();
> > > > System.out.println(ac.getTodosUsuarios());
> > > > session.setAttribute( "result",
> > > > ac.getTodosUsuarios() );
> > > > %>
> > > > <html>
> > > > <head>
> > > > 
> > > > <script language='javascript'
> > > > src="src/javascript/jquery.js"
> > > >
> > type="text/javascript"></script>
> > > > <script
> > > >
> > src="src/javascript/displayTagAjax.js">
> > > > 
> > > > </script>
> > > > </head>
> > > > <body>
> > > > 
> > > >  
> > > > <div id="ajxDspId"> 
> > > > <display:table
> > name="sessionScope.result"
> > > > pagesize="2"
> > htmlId="dispTable"
> > > > sort="list">
> > > > <display:column property="idUsuario"
> > > > title="ID" />
> > > > <display:column property="nombre"
> > > > sortable="true"/>
> > > > <display:column property="mail"
> > > > sortable="true"/>
> > > > 
> > > > </display:table> 
> > > > </div>
> > > > <!--- end display tag -->
> > > > 
> > > >  
> > > > </body>
> > > > </html>
> > > >  
> > > >  
> > > > If after the login my action goes to the
> > test.page
> > > > directly, it works properly and the links are
> > changed. 
> > > >  
> > > > But if after the login I go to a new page with a
> > menu:
> > > >  
> > > > <%@ page pageEncoding="ISO-8859-1"
> > %>
> > > > <%@ taglib prefix="s"
> > > > uri="/struts-tags" %>
> > > > <html>
> > > > <head>
> > > > <script language='javascript'
> > > > src="src/javascript/jquery.js"
> > > >
> > type="text/javascript"></script>
> > > > <script
> > > >
> > src="src/javascript/displayTagAjax.js"></script>
> > > > <script
> > > >
> > src="src/javascript/optiontransferselect.js"
> > > > type="text/javascript"/>
> > > > <s:head theme="ajax"/>
> > > > <link rel="stylesheet"
> > media="all"
> > > > type="text/css"
> > > > href="src/css/default.css" />
> > > > <script
> > src="src/javascript/stuHover.js"
> > > >
> > type="text/javascript"></script>
> > > > 
> > > > </head>
> > > > 
> > > > <body> 
> > > > 
> > > > <s:div id="divPagina">
> > > > <s:url id="buscarUsuario"
> > > > action='IrBuscarUsuario'/>
> > > > 
> > > > <s:div id="divMenu">
> > > > <img class="logo"
> > > > src=".../../src/images/logo.jpg"/>
> > > > <br><br>
> > > > 
> > > > <ul id="menu">
> > > > <li class="sub">Usuarios
> > > > <ul>
> > > > <li><s:a
> > id="linkBuscarUsuario"
> > > > theme="ajax"
> > > > href="%{buscarUsuario}"
> > > > targets="divContenedor"
> > > > showLoadingText="false">Buscar
> > > > usuario</s:a></li>
> > > > </ul>
> > > > </li> 
> > > > </ul>
> > > > </s:div>
> > > > <s:div id="divContenedor"
> > > > theme="ajax">
> > > > </s:div>
> > > > </s:div>
> > > > <script>
> > > > 
> > > > </script> 
> > > > </body>
> > > > </html>
> > > >  
> > > > And when I go then to the test page (which must
> > be shown in
> > > > divContenedor), the links are not displayed ok
> > and when I
> > > > click on sorting or pagination, then it works but
> > the result
> > > > is not displayed in the divContenedor. It is
> > opened in a new
> > > > page and my menu is lost!
> > > >  
> > > > If I check with firebug, all js are loaded (in
> > the menu
> > > > page and in the test page).
> > > >  
> > > > > To: user@struts.apache.org> From:
> > > > laurie@holoweb.net> Subject: Re: Sorting with
> > displaytag
> > > > issue due to theme="ajax"> Date:
> > Tue, 9 Sep
> > > > 2008 18:08:57 -0400> > Francisco Exposito
> > wrote:>
> > > > > Also I've tried to use displayTagAjax.
> > In order to
> > > > use it, I define in the main page:> > >
> > >
> > > > <script
> > src="src/javascript/displayTagAjax.js"
> > > > type="text/javascript"/>> >
> > <script
> > > > src="src/javascript/jquery.js"
> > > > type="text/javascript"/>> >
> > > > But
> > > > when I reload this page, I receive the error
> > "jQuery is
> > > > not defined" and the error seems to be in
> > the line of
> > > > displayTagAjax.js: > > > >
> > jQuery(function($)
> > > > {> > changeLinks();> > }); > >
> > I assume it
> > > > was a typo, since in a later email you have the
> > order >
> > > > corrected. But just in case it's the obvious
> > thing:
> > > > since > displayTagAjax.js conatains a call to
> > jQuery, the
> > > > jquery.js script needs > to be loaded
> > first...> >
> > > > L.> > >
> > > >
> > --------------------------------------------------------------------->
> > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@struts.apache.org> For
> > additional
> > > > commands, e-mail: user-help@struts.apache.org>
> > 
> > > >
> > _________________________________________________________________
> > > > ¿Sigue el calor? Consulta MSN El tiempo
> > > > http://eltiempo.es.msn.com/
> > > 
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > user-help@struts.apache.org
> > > 
> > 
> > _________________________________________________________________
> > Llega la nueva temporada. Consulta las nuevas tendencias en
> > MSN Estilo
> > http://estilo.es.msn.com/moda/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
¿Eres un cotilla? Disfruta de todas las novedades en MSN Corazón
http://entretenimiento.es.msn.com/corazon/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message