You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ed _ <ed...@hotmail.com> on 2008/12/05 23:49:51 UTC

create clickable icons (serving as external links) - Sends server into a endless loop

I am trying to create clickable icons that would link to an external page. 

I came across - http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html - But the server just goes into an endless loop. 

pointers?

Ed


ExternalLink link = new ExternalLink("partnerLink", partnerLink);
        StaticImage sImg = new StaticImage("partnerIcon", new Model(partnerIconUrl));
        link.add(sImg);
        add(link);


html xmlns:wicket>
<wicket:panel>
    <div class="partner_panel">
        <a href="#" wicket:id="partnerLink">
             <img wicket:id="partnerIcon" width="50" height="35" src="#" />
        </a>
    </div>
</wicket:panel>
</html>


class StaticImage extends WebComponent {

    public StaticImage(String id, IModel model) {
        super(id, model);
    }

    protected void onComponentTag(ComponentTag tag) {
        super.onComponentTag(tag);
        checkComponentTag(tag, "img");
        tag.put("src", getModelObjectAsString());
    }

}


_________________________________________________________________
Suspicious message? There’s an alert for that. 
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008

Re: create clickable icons (serving as external links) - Sends server into a endless loop

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Help me out a little more...

If it's truly while "rendering" (on the server), and enters an "infinite
loop" - must be a stack overflow, in which case, send the stack trace.

I think you mean that it's "while rendering" **in the browser**, for
instance by requesting the page again and again, etc.. If this is the case,
send us the generated HTML using a tool like tamper data in Firefox, for
example.

Also, just for kicks, try it without the "#" in the image tag and see if
that changes anything.
-- 
Jeremy Thomerson
http://www.wickettraining.com


On Fri, Dec 5, 2008 at 5:38 PM, Ed _ <ed...@hotmail.com> wrote:

>
> The problem occers when it is rendering.
>
>
> The images / page render fine when the src is hardcoded in the html file.
>
> It also works when I use the web markupcontainer and manipulate the src
> attribute as shown below.
>
> ExternalLink link = new ExternalLink("partnerLink", partnerLink);
>        final String imageUrl = partnerIconUrl;
>        WebMarkupContainer srcTag = new WebMarkupContainer("partnerIcon");
>        IModel mediaSrc = new AbstractReadOnlyModel(){
>            @Override
>            public String getObject(){
>                return imageUrl;
>            }
>        };
>        srcTag.add(new AttributeModifier("src", mediaSrc));
>
>        link.add(srcTag);
>        add(link);
>
> > Date: Fri, 5 Dec 2008 16:59:17 -0600
> > From: jeremy@wickettraining.com
> > To: users@wicket.apache.org
> > Subject: Re: create clickable icons (serving as external links) - Sends
> server into a endless loop
>  >
> > I don't see anything right away wrong with your code below.   So, maybe a
> > couple questions will help:
> >
> > Goes into an endless loop when?  When it's rendering?  When loading
> image?
> > When clicking on link?
> > Also - what HTML does your code below produce?
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> > On Fri, Dec 5, 2008 at 4:49 PM, Ed _ <ed...@hotmail.com> wrote:
> >
> > >
> > > I am trying to create clickable icons that would link to an external
> page.
> > >
> > > I came across -
> > > http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html -
> But
> > > the server just goes into an endless loop.
> > >
> > > pointers?
> > >
> > > Ed
> > >
> > >
> > > ExternalLink link = new ExternalLink("partnerLink", partnerLink);
> > >        StaticImage sImg = new StaticImage("partnerIcon", new
> > > Model(partnerIconUrl));
> > >        link.add(sImg);
> > >        add(link);
> > >
> > >
> > > html xmlns:wicket>
> > > <wicket:panel>
> > >    <div class="partner_panel">
> > >        <a href="#" wicket:id="partnerLink">
> > >             <img wicket:id="partnerIcon" width="50" height="35" src="#"
> />
> > >        </a>
> > >    </div>
> > > </wicket:panel>
> > > </html>
> > >
> > >
> > > class StaticImage extends WebComponent {
> > >
> > >    public StaticImage(String id, IModel model) {
> > >        super(id, model);
> > >    }
> > >
> > >    protected void onComponentTag(ComponentTag tag) {
> > >        super.onComponentTag(tag);
> > >        checkComponentTag(tag, "img");
> > >        tag.put("src", getModelObjectAsString());
> > >    }
> > >
> > > }
> > >
> > >
> > > _________________________________________________________________
> > > Suspicious message? There's an alert for that.
> > >
> > >
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008
> > >
>
> _________________________________________________________________
> You live life online. So we put Windows on the web.
> http://clk.atdmt.com/MRT/go/127032869/direct/01/

RE: create clickable icons (serving as external links) - Sends server into a endless loop

Posted by Ed _ <ed...@hotmail.com>.
The problem occers when it is rendering. 


The images / page render fine when the src is hardcoded in the html file.

It also works when I use the web markupcontainer and manipulate the src attribute as shown below.

ExternalLink link = new ExternalLink("partnerLink", partnerLink);
        final String imageUrl = partnerIconUrl;
        WebMarkupContainer srcTag = new WebMarkupContainer("partnerIcon");
        IModel mediaSrc = new AbstractReadOnlyModel(){
            @Override
            public String getObject(){
                return imageUrl;
            }
        };
        srcTag.add(new AttributeModifier("src", mediaSrc));
        
        link.add(srcTag);
        add(link);

> Date: Fri, 5 Dec 2008 16:59:17 -0600
> From: jeremy@wickettraining.com
> To: users@wicket.apache.org
> Subject: Re: create clickable icons (serving as external links) - Sends server into a endless loop
> 
> I don't see anything right away wrong with your code below.   So, maybe a
> couple questions will help:
> 
> Goes into an endless loop when?  When it's rendering?  When loading image?
> When clicking on link?
> Also - what HTML does your code below produce?
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> On Fri, Dec 5, 2008 at 4:49 PM, Ed _ <ed...@hotmail.com> wrote:
> 
> >
> > I am trying to create clickable icons that would link to an external page.
> >
> > I came across -
> > http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html - But
> > the server just goes into an endless loop.
> >
> > pointers?
> >
> > Ed
> >
> >
> > ExternalLink link = new ExternalLink("partnerLink", partnerLink);
> >        StaticImage sImg = new StaticImage("partnerIcon", new
> > Model(partnerIconUrl));
> >        link.add(sImg);
> >        add(link);
> >
> >
> > html xmlns:wicket>
> > <wicket:panel>
> >    <div class="partner_panel">
> >        <a href="#" wicket:id="partnerLink">
> >             <img wicket:id="partnerIcon" width="50" height="35" src="#" />
> >        </a>
> >    </div>
> > </wicket:panel>
> > </html>
> >
> >
> > class StaticImage extends WebComponent {
> >
> >    public StaticImage(String id, IModel model) {
> >        super(id, model);
> >    }
> >
> >    protected void onComponentTag(ComponentTag tag) {
> >        super.onComponentTag(tag);
> >        checkComponentTag(tag, "img");
> >        tag.put("src", getModelObjectAsString());
> >    }
> >
> > }
> >
> >
> > _________________________________________________________________
> > Suspicious message? There's an alert for that.
> >
> > http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008
> >

_________________________________________________________________
You live life online. So we put Windows on the web. 
http://clk.atdmt.com/MRT/go/127032869/direct/01/

Re: create clickable icons (serving as external links) - Sends server into a endless loop

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I don't see anything right away wrong with your code below.   So, maybe a
couple questions will help:

Goes into an endless loop when?  When it's rendering?  When loading image?
When clicking on link?
Also - what HTML does your code below produce?

-- 
Jeremy Thomerson
http://www.wickettraining.com


On Fri, Dec 5, 2008 at 4:49 PM, Ed _ <ed...@hotmail.com> wrote:

>
> I am trying to create clickable icons that would link to an external page.
>
> I came across -
> http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html - But
> the server just goes into an endless loop.
>
> pointers?
>
> Ed
>
>
> ExternalLink link = new ExternalLink("partnerLink", partnerLink);
>        StaticImage sImg = new StaticImage("partnerIcon", new
> Model(partnerIconUrl));
>        link.add(sImg);
>        add(link);
>
>
> html xmlns:wicket>
> <wicket:panel>
>    <div class="partner_panel">
>        <a href="#" wicket:id="partnerLink">
>             <img wicket:id="partnerIcon" width="50" height="35" src="#" />
>        </a>
>    </div>
> </wicket:panel>
> </html>
>
>
> class StaticImage extends WebComponent {
>
>    public StaticImage(String id, IModel model) {
>        super(id, model);
>    }
>
>    protected void onComponentTag(ComponentTag tag) {
>        super.onComponentTag(tag);
>        checkComponentTag(tag, "img");
>        tag.put("src", getModelObjectAsString());
>    }
>
> }
>
>
> _________________________________________________________________
> Suspicious message? There's an alert for that.
>
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008
>