热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址
首页 / 面试主题 / Apache Wicket
WithoutBook LIVE 模拟面试 Apache Wicket 相关面试主题: 39

面试题与答案

了解热门 Apache Wicket 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

共 26 道题 面试题与答案

面试前建议观看的最佳 LIVE 模拟面试

了解热门 Apache Wicket 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

面试题与答案

搜索问题以查看答案。

资深 / 专家级别面试题与答案

问题 1

How to create Select Option as menu wise in apache-wicket?

//Java 
import org.apache.wicket.extensions.markup.html.form.select.Select;
import org.apache.wicket.extensions.markup.html.form.select.SelectOption;
...
        //variable to hold the selected value from dropdown box,
        //and also make "jQuery" selected by default
        private String selected = "jQuery";
 
Select languages = new Select("languages", new PropertyModel<String>(this, "selected"));
form.add(languages);
languages.add(new SelectOption<String>("framework1", new Model<String>("Wicket")));
languages.add(new SelectOption<String>("framework2", new Model<String>("Spring MVC")));
languages.add(new SelectOption<String>("framework3", new Model<String>("JSF 2.0")));
languages.add(new SelectOption<String>("Script1", new Model<String>("jQuery")));
languages.add(new SelectOption<String>("Script2", new Model<String>("prototype")));
 
//HTML for dropdown box
<select wicket:id="languages">
<optgroup label="Frameworks">
<option wicket:id="framework1" >Wicket (1.4.7)</option>
<option wicket:id="framework2" >Spring MVC (3.0)</option>
<option wicket:id="framework3" >JSF (2.0)</option>
</optgroup>
<optgroup label="JavaScript">
<option wicket:id="Script1" >jQuery (1.6.1)</option>
<option wicket:id="Script2" >prototype (1.7)</option>
</optgroup>
</select>
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 2

What is Pallet component in apache-wicket?

Wicket extension comes with a special Palette component, which render two select boxes, and allow user to move items from one select box into another.

//Java
import org.apache.wicket.extensions.markup.html.form.palette.Palette;
 
final Palette<Hosting> palette = new Palette<Hosting>("palette",
new ListModel<Hosting>(selected),
new CollectionModel<Hosting>(listHosting),
renderer, 10, true);
 
 
//HTML
<span wicket:id="palette"></span>
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 3

How to create custom validator in apache-wicket?

See summary steps to create a custom validator :

1. Implements IValidator.

import org.apache.wicket.validation.IValidator;
 
public class StrongPasswordValidator implements IValidator<String>{
...
}

2. Override validate(IValidatable validatable).

public class StrongPasswordValidator implements IValidator<String>{
...
@Override
public void validate(IValidatable<String> validatable) {
 
//get input from attached component
final String field = validatable.getValue();
 
}
}

3. Attached custom validator to form component.

public class CustomValidatorPage extends WebPage {
 
public CustomValidatorPage(final PageParameters parameters) {
 
     final PasswordTextField password = new PasswordTextField("password",Model.of(""));
//attached custom validator to password field
password.add(new StrongPasswordValidator());
 
//...
}
 
}
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 4

How to integrate apache-wicket with Spring?

Override Wicket application init() method with this addComponentInstantiationListener(new SpringComponentInjector(this));.

File : Wicket application class

package com.withoutbook;
 
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import com.withoutbook.user.SimplePage;
 
public class WicketApplication extends WebApplication {
 
@Override
public Class<SimplePage> getHomePage() {
 
return SimplePage.class; // return default page
}
 
@Override
protected void init() {
 
super.init();
addComponentInstantiationListener(new SpringComponentInjector(this));
 
}
 
}
Now, you can inject Spring bean into Wicket component via @SpringBean.
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 5

How to get ServletContext in apache-wicket application?

Yes, you can get the ServletContext class via Wickets WebApplication class like this :

import javax.servlet.ServletContext;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import com.withoutbook.hello.Hello;
 
public class CustomApplication extends WebApplication {
 
@Override
public Class<? extends Page> getHomePage() {
 
ServletContext servletContext = WebApplication.get().getServletContext();
return Hello.class; //return default page
 
}
 
}
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 6

How to keep file validation in apache-wicket if no file has been selected?

To fix it, just override the validateOnNullValue() method like this :

FileUploadField fileUpload = new FileUploadField("fileupload",new Model<FileUpload>());
 
fileUpload .add(new AbstractValidator() { 
 
       public boolean validateOnNullValue(){
       return true;
}
 
protected void onValidate(IValidatable validatable) { 
FileUpload fileUpload = (FileUpload) validatable.getValue();
}
 
    protected String resourceKey() {
   return "yourErrorKey";
}
 
});
Now, when no file is selected, and submit button is clicked, validation will be performed.
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 7

How to create 404 error page?

<filter-mapping>
<filter-name>wicket.wicketTest</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<error-page>
<error-code>404</error-code>
<location>/error404</location>
</error-page>
public class WicketApplication extends WebApplication {
 
@Override
protected void init() {
 
mount(new QueryStringUrlCodingStrategy("error404",ErrorPage404.class));
 
}
 
}
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。