You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Søren Blidorf <so...@nolas.dk> on 2010/04/10 08:55:19 UTC

listing bean onmouseover

Hi.

 

I have a struts bean containing id, name, phone, email.

 

What I want to do is listing id, and onmouseover display the rest of the
values of the bean in the same page without refer or refresh.

 

Is there a Struts way to to it or is the way to do it to put the bean values
in a javascript array and use javascript to do it???

 

Any idears

 

Soren, DK

 


RE: listing bean onmouseover

Posted by Martin Gainty <mg...@hotmail.com>.
yes that would work well heres a solution using the onmouseover on a div tag inside sx:bind

 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<html>
<head>
    <title>Bind Examples</title>
    <jsp:include page="/ajax/commonInclude.jsp"/>
</head>

 

<script type="text/javascript">
<!-- subscribe (tie) the AjaxTest.action to function(data.request.widget) -->   
   dojo.event.topic.subscribe("/AjaxTest.action", function(data, request, widget){
      alert('inside a topic event. after request');
      //data : text returned from request
      //request: XMLHttpRequest object
      //widget: widget that published the topic
   });
</script>

<body>

<div id="div1">Div 1</div>

 

<!-- notice AjaxTest.action will generate a new result on each mouseover of div2 below -->
<s:url var="ajaxTest" value="/AjaxTest.action" />

<br/>

<p>
    2. Attach to "onmouseover" event on Area below and update content of Div1, highlight targets with green color
    <sx:bind id="ex2" href="%{#ajaxTest}" sources="div2" targets="div1" events="onmouseover" highlightColor="green"/>
    <div id="div2" style="width: 300px; height: 50px; border: 1px solid black">
       MouseOver div2 to activate AjaxTest.action and generate a new result
    </div>
</p>
<br/>
...

</body>

</html>


//make a backup of the previous index.jsp

mv \webapps\showcase-2.1.8\ajax\bind\index.jsp \webapps\showcase-2.1.8\ajax\bind\index.jsp.bak

then copy the contents of this jsp page to \webapps\showcase-2.1.8\ajax\bind\index.jsp

reload struts2-showcase-2.1.8 

http://host:PORT/showcase-2.1.8/ajax/bind/index.jsp

 

mouseover div2 and watch AjaxTest update the result!

all you have to do is change the AjaxTest action class

package org.apache.struts2.showcase.ajax;

public class AjaxTestAction implements Action, Serializable {

    private static int counter = 0;
    private String data;

    public long getServerTime() {
        return System.currentTimeMillis();
    }

    public int getCount() {
        return ++counter;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String execute() throws Exception {
        return SUCCESS;
    }
}


<!-- here is the AjaxResult.jsp that gets included in -->

<%@ taglib prefix="s" uri="/struts-tags" %>

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

Result: <s:property value="count"/> @ <s:property value="serverTime"/> 
<br/>
<s:property value="data"/>


for both org.apache.struts2.showcase.ajax.AjaxTestAction.java and AjaxResult.jsp:

change count to id
change serverTime to name

add phone attribute to  org.apache.struts2.showcase.ajax.AjaxTestAction.java and AjaxResult.jsp

add email  attribute to  org.apache.struts2.showcase.ajax.AjaxTestAction.java and AjaxResult.jsp

 

Thanks Burt!
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> Date: Sat, 10 Apr 2010 19:39:33 -0500
> Subject: Re: listing bean onmouseover
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> Without knowing the specific implementation its hard to say. But one
> way would be to preload all the data (and layout) in a div tag
> display:none. On mouseover display the div or insert the html of the
> div wherever you want on the page using JavaScript. Custom tag
> sounds overkill to me. Always more than one way to skin a cat though.
> 
> On 4/10/10, Martin Gainty <mg...@hotmail.com> wrote:
> >
> > Burt--
> >
> >
> >
> > i proposed crafting a custom tag for onMouseOver (using SubmitTag) but
> > admittedly JS would be easier for Soren
> >
> > any suggestions on specifics of the JS implementation?
> >
> >
> > Thanks,
> > Martin
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> > dient lediglich dem Austausch von Informationen und entfaltet keine
> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> > aucune responsabilité pour le contenu fourni.
> >
> >
> >
> >
> >
> >> Date: Sat, 10 Apr 2010 08:20:39 -0500
> >> Subject: Re: listing bean onmouseover
> >> From: burtonrhodes@gmail.com
> >> To: user@struts.apache.org
> >>
> >> Sounds like a javascript solution to me.
> >>
> >> On 4/10/10, Søren Blidorf <so...@nolas.dk> wrote:
> >> > Hi.
> >> >
> >> >
> >> >
> >> > I have a struts bean containing id, name, phone, email.
> >> >
> >> >
> >> >
> >> > What I want to do is listing id, and onmouseover display the rest of the
> >> > values of the bean in the same page without refer or refresh.
> >> >
> >> >
> >> >
> >> > Is there a Struts way to to it or is the way to do it to put the bean
> >> > values
> >> > in a javascript array and use javascript to do it???
> >> >
> >> >
> >> >
> >> > Any idears
> >> >
> >> >
> >> >
> >> > Soren, DK
> >> >
> >> >
> >> >
> >> >
> >>
> >> --
> >> Sent from my mobile device
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> > 
> > _________________________________________________________________
> > Hotmail is redefining busy with tools for the New Busy. Get more from your
> > inbox.
> > http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> 
> -- 
> Sent from my mobile device
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

Re: listing bean onmouseover

Posted by Burton Rhodes <bu...@gmail.com>.
Without knowing the specific implementation its hard to say. But one
way would be to preload all the data (and layout) in a div tag
display:none. On mouseover display the div or insert the html of the
div wherever you want on the page using JavaScript.   Custom tag
sounds overkill to me. Always more than one way to skin a cat though.

On 4/10/10, Martin Gainty <mg...@hotmail.com> wrote:
>
> Burt--
>
>
>
> i proposed crafting a custom tag for onMouseOver (using SubmitTag) but
> admittedly JS would be easier for Soren
>
> any suggestions on specifics of the JS implementation?
>
>
> Thanks,
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
>> Date: Sat, 10 Apr 2010 08:20:39 -0500
>> Subject: Re: listing bean onmouseover
>> From: burtonrhodes@gmail.com
>> To: user@struts.apache.org
>>
>> Sounds like a javascript solution to me.
>>
>> On 4/10/10, Søren Blidorf <so...@nolas.dk> wrote:
>> > Hi.
>> >
>> >
>> >
>> > I have a struts bean containing id, name, phone, email.
>> >
>> >
>> >
>> > What I want to do is listing id, and onmouseover display the rest of the
>> > values of the bean in the same page without refer or refresh.
>> >
>> >
>> >
>> > Is there a Struts way to to it or is the way to do it to put the bean
>> > values
>> > in a javascript array and use javascript to do it???
>> >
>> >
>> >
>> > Any idears
>> >
>> >
>> >
>> > Soren, DK
>> >
>> >
>> >
>> >
>>
>> --
>> Sent from my mobile device
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>  		 	   		
> _________________________________________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: listing bean onmouseover

Posted by Martin Gainty <mg...@hotmail.com>.
Burt--

 

i proposed crafting a custom tag for onMouseOver (using SubmitTag) but admittedly JS would be easier for Soren

any suggestions on specifics of the JS implementation?


Thanks,
Martin
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> Date: Sat, 10 Apr 2010 08:20:39 -0500
> Subject: Re: listing bean onmouseover
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> Sounds like a javascript solution to me.
> 
> On 4/10/10, Søren Blidorf <so...@nolas.dk> wrote:
> > Hi.
> >
> >
> >
> > I have a struts bean containing id, name, phone, email.
> >
> >
> >
> > What I want to do is listing id, and onmouseover display the rest of the
> > values of the bean in the same page without refer or refresh.
> >
> >
> >
> > Is there a Struts way to to it or is the way to do it to put the bean values
> > in a javascript array and use javascript to do it???
> >
> >
> >
> > Any idears
> >
> >
> >
> > Soren, DK
> >
> >
> >
> >
> 
> -- 
> Sent from my mobile device
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: listing bean onmouseover

Posted by Burton Rhodes <bu...@gmail.com>.
Sounds like a javascript solution to me.

On 4/10/10, Søren Blidorf <so...@nolas.dk> wrote:
> Hi.
>
>
>
> I have a struts bean containing id, name, phone, email.
>
>
>
> What I want to do is listing id, and onmouseover display the rest of the
> values of the bean in the same page without refer or refresh.
>
>
>
> Is there a Struts way to to it or is the way to do it to put the bean values
> in a javascript array and use javascript to do it???
>
>
>
> Any idears
>
>
>
> Soren, DK
>
>
>
>

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org