You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Delange <de...@telfort.nl> on 2012/11/07 11:53:08 UTC

ContextRelativeResource working different in WebMarkupContainer?

I try to show images from the images folder. When I use the following code,
it works:

<wicket:link>
<images/284/IMG_0013.JPG> 
</wicket:link>

form.add(new Image("imagetest",new
ContextRelativeResource("images/284/P1010841.JPG")));

The generated html code is:
<../page?1-IResourceListener-form-imagetest> 
Which is fine for me, cause it works


But putting the same code in a WebMarkupContainer and I don't get any image.
Even if I do a little trick on the first image where I use the same code as
above. Why is the webmarkupcontainer working DIFFERENTLY?? How to solve?


Here the code for the images in the webmarkupcontainer:
<ul class="jcarousel-skin-tango" id="mycarouselb" wicket:id="mycarousel" > 
		 	          <li>  <images/284/IMG_0013.JPG> </li>
                      <li>  <images/284/IMG_0147.JPG> </li> 
                      <li wicket:id="rv"> 
                          <wicket:link> <images/284/IMG_0013.JPG>
</wicket:link>
                      </li>
		 </ul>
JCarouselWebMarkupContainer jCarouselWebMarkupContainer = new
JCarouselWebMarkupContainer("mycarousel");
		File[] files = getUploadFolder(order.getImages()).listFiles();
		RepeatingView rv = new RepeatingView("rv");
		jCarouselWebMarkupContainer.add(rv);
		boolean first=true;
		for (final File file: files){
			WebMarkupContainer parent = new WebMarkupContainer(rv.newChildId());
			rv.add(parent);

			Image image=null;
			if (first) {
				image = new Image("image",new
ContextRelativeResource("images/284/P1010841.JPG"));
			}else
			    image = new Image("image", new
ContextRelativeResource("images/284/"+file.getName()));
			first = false;

			parent.add(image ) ;
		}	 

Webstructure
> myapplication
>> css
>> images
>> WEB-INF
>>> classes
etc






--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/ContextRelativeResource-working-different-in-WebMarkupContainer-tp4653675.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: ContextRelativeResource working different in WebMarkupContainer?

Posted by Paul Bors <pa...@bors.ws>.
Have you turned on the automatic linking inside your webapp markup settings?

<wicket:link> as documented at:
https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtag
s-Elementwicket%253Alink

Supports the autolink functionality documented at:
https://cwiki.apache.org/WICKET/autolink.html

~ Thank you,
  Paul Bors

-----Original Message-----
From: Delange [mailto:delanger@telfort.nl] 
Sent: Wednesday, November 07, 2012 5:53 AM
To: users@wicket.apache.org
Subject: ContextRelativeResource working different in WebMarkupContainer?

I try to show images from the images folder. When I use the following code,
it works:

<wicket:link>
<images/284/IMG_0013.JPG>
</wicket:link>

form.add(new Image("imagetest",new
ContextRelativeResource("images/284/P1010841.JPG")));

The generated html code is:
<../page?1-IResourceListener-form-imagetest>
Which is fine for me, cause it works


But putting the same code in a WebMarkupContainer and I don't get any image.
Even if I do a little trick on the first image where I use the same code as
above. Why is the webmarkupcontainer working DIFFERENTLY?? How to solve?


Here the code for the images in the webmarkupcontainer:
<ul class="jcarousel-skin-tango" id="mycarouselb" wicket:id="mycarousel" > 
		 	          <li>  <images/284/IMG_0013.JPG> </li>
                      <li>  <images/284/IMG_0147.JPG> </li> 
                      <li wicket:id="rv"> 
                          <wicket:link> <images/284/IMG_0013.JPG>
</wicket:link>
                      </li>
		 </ul>
JCarouselWebMarkupContainer jCarouselWebMarkupContainer = new
JCarouselWebMarkupContainer("mycarousel");
		File[] files =
getUploadFolder(order.getImages()).listFiles();
		RepeatingView rv = new RepeatingView("rv");
		jCarouselWebMarkupContainer.add(rv);
		boolean first=true;
		for (final File file: files){
			WebMarkupContainer parent = new
WebMarkupContainer(rv.newChildId());
			rv.add(parent);

			Image image=null;
			if (first) {
				image = new Image("image",new
ContextRelativeResource("images/284/P1010841.JPG"));
			}else
			    image = new Image("image", new
ContextRelativeResource("images/284/"+file.getName()));
			first = false;

			parent.add(image ) ;
		}	 

Webstructure
> myapplication
>> css
>> images
>> WEB-INF
>>> classes
etc






--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/ContextRelativeResource-working-d
ifferent-in-WebMarkupContainer-tp4653675.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org