lets take your exact usecase, hiding and showing form components based on some condition.

there are two basic strategies to do this:

1) add all of them an then toggle visibility

this means you add all possible formcomponents and then override isVisible() on them or call setVisible(false). this will tell wicket not to render the portion of html associated with that component.

so instead of <c:if condition="blah"><input type="text" name="comp" value="${val}"/></c:if> in jsp you would have

add(new TextField("comp",...) {
       boolean isVisible() {
           return blah;
        }
}

and in html <input type="text" wicket:id="comp"/>


2) swapping panels - this is usually used for bigger chunks of the page then formcomponents. a good analagy for this is the tabbed view.

when you click a tab the body of the view has to change to show a different tab's body. each tab's body can be represented as a panel so when a tab is clicked it can swap the panel in the body of the tabbed panel with the panel of its chosing.

see our TabbedPanel for example in code and in our component reference which shows a short example

hope this helps,

-Igor



On 5/4/06, Rivka Shisman <[EMAIL PROTECTED]> wrote:
Hi Eelco,

Do you mean that I should create a "panel" with a link to my own servlet
that shows the dynamic content?

Thanks
Rivka


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Eelco
Hillenius
Sent: Thursday, May 04, 2006 10:21 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] dynamic html controls

You can do what is outlined here:
http://wicket-wiki.org.uk/wiki/index.php/Create_dynamic_markup_hierarchi
es_using_panels

Or - like the article says, add all visible components and use the
isVisible property (or override the method) for turning them on or
off.

Or use Fragments, which work like panels, but have their markup
definded in the same markup (HTML) file.

Eelco

On 5/4/06, Rivka Shisman <[EMAIL PROTECTED] > wrote:
>
>
>
> Hi
>
>
>
> I have no experience with Wicket, but from what I read about it I
don't
> understand where does the dynamic content part come in?
>
> If I have a pair of html file and a java file - how do I conditionally
> show/hide html form controls like I do in JSP?
>
>
>
> For example, I have a JSP page that constructs my form text fields
(and
> labels) from a result of a select from the database?
>
> Is that possible to achieve with Wicket?
>
>
>
> Thanks
>
> Rivka
>
>
>
>


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to