Wicket filelist item as link on webpage

77 views Asked by At

I am Using Apache Wicket and I have a multiuploadfield component to upload files. When the files are uploaded they are rendered as a list of files on the webpage. The files are rendered by the filelist object. I use this filelist item as a link.

This is the HTML code for that:

<strong>hello</strong>
<div class="menu_simple">
    <ul id="nav" wicket:id="fileList">
        <li width="200"><a href="#"wicket:id="file">(file)</a>
            <ul>
                <li><a href="";>TREE NODE</a></li>
                <li><a href="#">Service2</a></li>
                <li><a href="#">Service3</a></li>
            </ul>
        </li>
    </ul>
</div>
<div class="menu_simple">
    <ul id="nav" wicket:id="fileList">
        <li width="200">
            <a href="#"wicket:id="file">(file)</a>
            <p>Name of file uploaded. When you hover on this you see three services</p> 
            <ul>
                <li><a href="#">service1</a></li>
                <li><a href="#">Service2</a></li>
                <li><a href="#">Service3</a></li>
            </ul>
        </li>
    </ul>
</div>

I want each filelist item to have different url and when click on this it should take me to that page.

For instance: The first filelist item should be a link to Google, second should be a link to Yahoo, third should be link to Youtube and so on. Is there any way I can do it?

1

There are 1 answers

0
Rob Audenaerde On

You can control each link in Wicket.

There are several Link types. See here: http://wicket.apache.org/guide/guide/urls.html

You will need ExternalPageLink.

<a wicket:id="externalSite">Search 'my little pony' on Google!</a>

Java code:

String query="my little pony";
//Space characters must be replaced by character '+'
String googleQuery = "http://www.google.com/search?q=" + query.replace(" ", "+");
add(new ExternalLink("externalSite", googleQuery));