[ 
https://issues.apache.org/jira/browse/WICKET-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13608731#comment-13608731
 ] 

Martin Grigorov commented on WICKET-5109:
-----------------------------------------

Even if the href doesn't start with '{{' Wicket will still try to make the url 
relative to the current base url (the url of the current page).
You can use this Panel in PageA mounted at /page/a, but you can also use it in 
PageB mounted at /some/deeper/path/page/b.
If you use url starting with '/' then this means the path is absolute and there 
is no need Wicket to relativize it. But if the url is relative then Wicket 
plays smart.

In short - this is how Wicket works.
                
> Panel adds "../" to "a href" markup that begins with "{{"
> ---------------------------------------------------------
>
>                 Key: WICKET-5109
>                 URL: https://issues.apache.org/jira/browse/WICKET-5109
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.5.0
>         Environment: Karaf
>   Karaf version               2.3.0
>   Karaf home                  /home/aldo/git/bippo-commerce5/karaf_tuneeca
>   Karaf base                  /home/aldo/git/bippo-commerce5/karaf_tuneeca
>   OSGi Framework              org.apache.felix.framework - 4.0.3
> JVM
>   Java Virtual Machine        OpenJDK 64-Bit Server VM version 23.2-b09
>   Version                     1.7.0_09
>   Vendor                      Oracle Corporation
>   Uptime                      6 minutes
>   Total compile time          1 minute
> Threads
>   Live threads                92
>   Daemon threads              77
>   Peak                        131
>   Total started               298
> Memory
>   Current heap size           146,039 kbytes
>   Maximum heap size           466,048 kbytes
>   Committed heap size         233,216 kbytes
>   Pending objects             0
>   Garbage collector           Name = 'PS Scavenge', Collections = 76, Time = 
> 1.060 seconds
>   Garbage collector           Name = 'PS MarkSweep', Collections = 2, Time = 
> 0.674 seconds
> Classes
>   Current classes loaded      14,950
>   Total classes loaded        15,883
>   Total classes unloaded      933
> Operating system
>   Name                        Linux version 3.5.0-21-generic
>   Architecture                amd64
>   Processors                  3
>            Reporter: aldo siregar
>
> My markup below 
> (/id.co.bippo.web/src/main/resources/id/co/bippo/web/pub/CategoryStaticSidebarPanel.html)
>  :
> {code}
> <wicket:panel>
>       <div class="CategorySidebar">
>               <div class="nav-container well sidebar-nav">
>                   <ul class="nav nav-list">
>               <!--         <li class="nav-header">Browse By Category</li> -->
>                       <li class="nav-header margin-bottom">Categories</li>
>                       <div class="accordion" id="accordion2">
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapseOne" 
> style="margin-left:-30px;">
>                                                               Apparels
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapseOne" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels/tops">Tops</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels/skirts">Skirts</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels/dresses">Dresses</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels/outers">Outers</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels/jackets">Jackets</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/apparels">All Apparels </a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsetwo" 
> style="margin-left:-30px;">
>                                                               Bags
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsetwo" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/bags/top-handles">Top Handles</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/bags/hobos">Hobos</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/bags">All Bags</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsethree" 
> style="margin-left:-30px;">
>                                                               Jewellery
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsethree" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/jewellery/necklace">Necklace</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/jewellery/brooch">Brooch</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/jewellery/hairband">Hairband</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/jewellery/bangles">Bangles</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/jewellery">All Jewellery</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsefour" 
> style="margin-left:-30px;">
>                                                               Fabrics (Kain)
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsefour" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/fabrics/batik">Batik</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/fabrics">All Fabrics</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsefive" 
> style="margin-left:-30px;">
>                                                               Shoes
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsefive" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/shoes/heels">Heels</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/shoes/wedges">Wedges</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/shoes">All Shoes</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsesix" 
> style="margin-left:-30px;">
>                                                               Small 
> Accessories
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsesix" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="{{webAddress.basePath}}category/accessories/wallets">Wallets</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/accessories/passport-wallets">Passport 
> Wallets</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/accessories/clutches">Clutches</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/accessories/makeup-pouches">Makeup 
> Pouches</a></li>
>                                                       <li><a 
> href="{{webAddress.basePath}}category/accessories">All Accessories </a></li>
>                                               </ul>
>                                       </div>
>                               </div>
>                               <hr>
>                               <ul class="nav">
>                                       <li><a 
> href="{{webAddress.basePath}}/shops">Brands</a></li>
>                               </ul>
>       <!--            <li class=""> -->
>       <!--                    <a class="" 
> href="{{webAddress.basePath}}category/accessories"><span>Small 
> Accessories</span></a> -->
>       <!--                    <ul class="subcat"> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="{{webAddress.basePath}}category/accessories/wallets"><span>Wallets</span></a>
>  -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="{{webAddress.basePath}}category/accessories/passport-wallets"><span>Passport
>  Wallets</span></a> -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="{{webAddress.basePath}}category/accessories/clutches"><span>Clutches</span></a>
>  -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="{{webAddress.basePath}}category/accessories/makeup-pouches"><span>Makeup
>  Pouches</span></a> -->
>       <!--                            </li> -->
>       <!--                    </ul> -->
>       <!--            </li> -->
>                       </ul>
>               </div>
>       </div>
> </wicket:panel>
> {code}
> All "a href=" becomes like this:
> {code}
> <li><a href="../{{webAddress.basePath}}category/apparels/tops">Tops</a></li>
> {code}
> Note the "../".
> If the href begins with "/", the markup is untouched.
> {code}
> <wicket:panel>
>       <div class="CategorySidebar">
>               <div class="nav-container well sidebar-nav">
>                   <ul class="nav nav-list">
>               <!--         <li class="nav-header">Browse By Category</li> -->
>                       <li class="nav-header margin-bottom">Categories</li>
>                       <div class="accordion" id="accordion2">
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapseOne" 
> style="margin-left:-30px;">
>                                                               Apparels
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapseOne" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/apparels/tops">Tops</a></li>
>                                                       <li><a 
> href="/category/apparels/skirts">Skirts</a></li>
>                                                       <li><a 
> href="/category/apparels/dresses">Dresses</a></li>
>                                                       <li><a 
> href="/category/apparels/outers">Outers</a></li>
>                                                       <li><a 
> href="/category/apparels/jackets">Jackets</a></li>
>                                                       <li><a 
> href="/category/apparels">All Apparels </a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsetwo" 
> style="margin-left:-30px;">
>                                                               Bags
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsetwo" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/bags/top-handles">Top Handles</a></li>
>                                                       <li><a 
> href="/category/bags/hobos">Hobos</a></li>
>                                                       <li><a 
> href="/category/bags">All Bags</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsethree" 
> style="margin-left:-30px;">
>                                                               Jewellery
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsethree" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/jewellery/necklace">Necklace</a></li>
>                                                       <li><a 
> href="/category/jewellery/brooch">Brooch</a></li>
>                                                       <li><a 
> href="/category/jewellery/hairband">Hairband</a></li>
>                                                       <li><a 
> href="/category/jewellery/bangles">Bangles</a></li>
>                                                       <li><a 
> href="/category/jewellery">All Jewellery</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsefour" 
> style="margin-left:-30px;">
>                                                               Fabrics (Kain)
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsefour" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/fabrics/batik">Batik</a></li>
>                                                       <li><a 
> href="/category/fabrics">All Fabrics</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>                                       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsefive" 
> style="margin-left:-30px;">
>                                                               Shoes
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsefive" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/shoes/heels">Heels</a></li>
>                                                       <li><a 
> href="/category/shoes/wedges">Wedges</a></li>
>                                                       <li><a 
> href="/category/shoes">All Shoes</a></li>
>                                               </ul>
>                                       </div>
>                                       <hr>
>       
>                                       <div class="accordion-heading">
>                                               <ul class="nav nav-list">
>                                                       <li>
>                                                               <a 
> data-toggle="collapse" data-parent="#accordion2" href="#collapsesix" 
> style="margin-left:-30px;">
>                                                               Small 
> Accessories
>                                                               <b 
> class="caret"></b>
>                                                               </a>
>                                                       </li>
>                                               </ul>
>                                       </div>
>                                       <div id="collapsesix" 
> class="accordion-body collapse">
>                                               <ul class="nav nav-list">
>                                                       <li><a 
> href="/category/accessories/wallets">Wallets</a></li>
>                                                       <li><a 
> href="/category/accessories/passport-wallets">Passport Wallets</a></li>
>                                                       <li><a 
> href="/category/accessories/clutches">Clutches</a></li>
>                                                       <li><a 
> href="/category/accessories/makeup-pouches">Makeup Pouches</a></li>
>                                                       <li><a 
> href="/category/accessories">All Accessories </a></li>
>                                               </ul>
>                                       </div>
>                               </div>
>                               <hr>
>                               <ul class="nav">
>                                       <li><a href="/shops">Brands</a></li>
>                               </ul>
>       <!--            <li class=""> -->
>       <!--                    <a class="" 
> href="/category/accessories"><span>Small Accessories</span></a> -->
>       <!--                    <ul class="subcat"> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="/category/accessories/wallets"><span>Wallets</span></a> -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="/category/accessories/passport-wallets"><span>Passport 
> Wallets</span></a> -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="/category/accessories/clutches"><span>Clutches</span></a> -->
>       <!--                            </li> -->
>       <!--                            <li> -->
>       <!--                                    <a 
> href="/category/accessories/makeup-pouches"><span>Makeup Pouches</span></a> 
> -->
>       <!--                            </li> -->
>       <!--                    </ul> -->
>       <!--            </li> -->
>                       </ul>
>               </div>
>       </div>
> </wicket:panel>
> {code}
> Also, the A HREF markup inside HTML comments are not affected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to