Modal Panel is like a container that blocks the operation of base page when the modal panel is open. This can be used to create a good GUI application. Here in this section of Wicket tutorial we will use the modal panel to show images in the separate modal panel and in large size.
In this example we have created these following class files and corresponding to it there are HTML files as well.
ModalApplication.java
package com.roseindia.wicket;
|
ModalApplication extends WebApplication and calls Modal class. Here is the Modal class as follows:
Modal.java
package com.roseindia.wicket;
|
Modal.java extends WebPage and creates two ModalWindows and these are shown on the screen when request for them is generated by clicking on the ajax links by their id's "showModal1" and "showModal2". Corresponding to Modal class its HTML file is as follows:
Modal.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
ModalPage1.java
package com.roseindia.wicket;
|
ModalPage1.html
<html>
|
ModalPage2.java
package com.roseindia.wicket;
|
ModalPage2.html
<html>
|
One most important thing is to make entry of ModalApplication class file into the XML file web.xml following is the code fragments of web.xml file.
| <filter> <filter-name>ModalApplication</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>com.roseindia.wicket.ModalApplication</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> </filter> <filter-mapping> <filter-name>ModalApplication</filter-name> <url-pattern>/wicket/modal/*</url-pattern> </filter-mapping> |
To run this example start your web server and type the
following URL on to web browser address bar:
http://localhost:8080/WicketExample/wicket/modal
Output:

When you will click on the images icon then it will show that image in the Modal Panel.

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Modal Panel example in Wicket
Post your Comment