Ниже приведена страница, на которой выполняется рендеринг, и прикрепленная дочерняя страница:
Главная страница: LogLevelSettingManagement. java:
public class LogLevelSettingManagement extends BasePage {
public LogLevelSettingManagement(PageParameters pageParameters) {
super(pageParameters);
getPage().get("body:dynamicLoglevel").add(new AttributeAppender("class", new Model<String>("active"), ""));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void prepareForm(PageParameters pageParameters) {
getUserRoleScreenMap();
final Form<?> form = new Form("frmLoglevelMgmt");
final FeedbackPanel feedbackDiv = new FeedbackPanel("logLevelMgmtFeedbackPanel");
form.add(feedbackDiv.setOutputMarkupId(true));
AjaxLink addLink = (new AjaxLink("addRecord") {
/**
*
*/
private static final long serialVersionUID = 1219443392630482798L;
@Override
public void onClick(AjaxRequestTarget target) {
// TODO Auto-generated method stub
action = "add";
modalWindow.show(target);
}
});
logLevelList1 = new ArrayList<>();
try {
logLevelList1 = UserAuthenticationDAO.getInstance().getObjects("getAllConfLogLevel");
} catch (SQLException e) {
logger.info(e.getMessage());
logger.error("Exception while getting all logLevel data from ULF_LOG4J_LOG_LEVEL table", e);
}
ListView groupView = new ListView("lstColumnList", logLevelList1) {
/**
*
*/
private static final long serialVersionUID = -6841473204531956216L;
@Override
protected void populateItem(final ListItem pItem) {
logLevelConfigureModel = (LogLevelConfigureModel) pItem.getModelObject();
pItem.add(
new Label("lbllogLevelPackage", new PropertyModel(logLevelConfigureModel, "logLevelPackage")));
pItem.add(new Label("lbllogLevelName", new PropertyModel(logLevelConfigureModel, "logLevelName")));
AjaxLink editLink = new AjaxLink("lblEdit", pItem.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
action = "edit";
logLevelConfigureModel = (LogLevelConfigureModel) getModelObject();
modalWindow.show(target);
}
};
editLink.setVisible(true);
editLink.setOutputMarkupId(true);
editLink.add(new Label("edit", new PropertyModel(logLevelConfigureModel, "lnkEdit")));
pItem.add(editLink);
if (null != webRollModel && (!webRollModel.isEdit_flg())) {
editLink.setEnabled(false);
}
}
};
modalWindow = new ModalWindow("modalWin");
modalWindow.setTitle("Log Level Creation");
modalWindow.setInitialHeight(520);
modalWindow.setInitialWidth(712);
modalWindow.setCookieName("modalWin-1");
modalWindow.setPageCreator(new ModalWindow.PageCreator() {
/**
*
*/
private static final long serialVersionUID = -1127666594464759244L;
@Override
public Page createPage() {
return new LogLevelCreation(LogLevelSettingManagement.this, modalWindow, action,
logLevelConfigureModel.copy()) {
/**
*
*/
private static final long serialVersionUID = 7425390418605058958L;
@Override
void setAction(String value) {
action = value;
}
};
}
});
modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
/**
*
*/
private static final long serialVersionUID = 5886472905133621681L;
@Override
public void onClose(AjaxRequestTarget target) {
// TODO Auto-generated method stub
setResponsePage(LogLevelSettingManagement.class);
}
});
wmc.add(modalWindow);
AjaxLink applySettings = (new AjaxLink("saveSettings") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getAllLogLevelData();
getSession().cleanupFeedbackMessages();
getSession().info("Log levels are updated successfully");
getSession().cleanupFeedbackMessages();
form.add(feedbackDiv);
setDataTableRefreshRequired(true);
target.add(form);
}
});
form.add(addLink);
form.add(applySettings);
form.add(groupView);
wmc.add(modalWindow);
wmc.add(form);
}
html:
<!DOCTYPE html>
<html>
<head>
<wicket:head><title>Log Server - Log Level Settings Management</title>
<script type="text/javascript" src="./scripts/help.js" charset="utf-8"></script>
</wicket:head>
</head>
<body>
<wicket:extend>
<div>
<div class="wideCap wideCap_wide">
<form wicket:id="frmLoglevelMgmt">
<div class="top">
<div class="h1holder">
<h2>
Configure Log Level
</h2>
</div>
</div>
<div class="repeat">
<ul class="feedback" id="feedback"
wicket:id="logLevelMgmtFeedbackPanel">
</ul>
<!-- <table wicket:id="datatable" class="dataview" id="idd"
cellspacing="0" width="100%"></table> -->
<div>
<table border="0" cellspacing=0 cellpadding=0 width="100%"
style="table-layout: fixed;">
<tr width="90%">
<th width="15%">log Level Package</th>
<th width="15%">Log Level</th>
<th width="10%">Edit</th>
</tr>
<tr wicket:id="lstColumnList" width="90%">
<td style="padding-left: 10px;" class="wrapword"><span wicket:id="lbllogLevelPackage"></span>
</td>
<td style="padding-left: 10px;" class="wrapword"><span
wicket:id="lbllogLevelName"></span>
</td>
<td style="padding-left: 10px;" ><a wicket:id="lblEdit"><span
wicket:id="edit"></span> </a>
</td>
</tr>
</table>
</div>
<table align="center">
<tr>
<td colspan="2" style="text-align: center; padding-top: 10px;">
<span class="btn_or_span"><input type="submit" value="Apply above settings"
wicket:id="saveSettings" id="saveSettings" class="btn_or_sbt" /></span>
</td>
</tr>
</table>
</div>
</form>
</div>
<div wicket:id="modalWin"></div>
</div>
</wicket:extend>
</body>
</html>
И страница в модальном окне:
LoglevelCreation. html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Log Level Creation</title>
</head>
<body wicket:id="body" onload="">
<div id="flyout-mask"></div>
<div id="bysy_indicator"
style="position: absolute; top: 50%; left: 50%; margin-top: -50px; margin-left: -50px; width: 50px; height: 50px;">
<img id="busyImg" wicket:id="flyoutImg" width="50" height="50" />
</div>
<span class="Title">Log Level Creation</span> <br /> <br />
<form wicket:id="form" style="border: none;">
<div class="feedback" wicket:id="logLevelCreationFeedbackPanel"></div>
<table align="left">
<tr>
<td style="padding-left: 10px;">Log Level Package</td>
<td><input type="text" wicket:id="loglevelPackage" class="mandatoryFlag" size="35"/></td>
</tr>
<tr>
<td style="padding-left: 10px;">Log Level</td>
<td><select wicket:id="logLevelName" class="mandatoryFlag" >
<option>--Select Log Level--</option>
</select></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<table width="80%" class="repeat" align="center">
<tr style="height: 35px; text-align: top">
<td style="text-align: center;" colspan="4">
<span class="btn_or_span"><input type="submit" value="Save"
wicket:id="saveEditAdd" id="saveEditAdd" class="submit" /></span> <span
class="btn_or_span"><input type="submit" value="Cancel"
wicket:id="cancel" id="cancel" class="submit" /></span>
</td>
</tr>
</table>
</form>
</body>
</html>
И класс java для создания уровня лога. html:
public abstract class LogLevelCreation extends WebPage implements IHeaderContributor{
/**
*
*/
private static final long serialVersionUID = -1466788110179772918L;
private static final String FEEDBACK_DIV = "logLevelCreationFeedbackPanel";
private static final Logger logger = LogManager.getLogger(LogLevelCreation.class);
private static ResourceReference pkgResourcereference = new ResourceReference(BasePage.class, "./loading.gif") {
private static final long serialVersionUID = 1L;
@Override
public IResource getResource() {
return new ResourceStreamResource(new FileResourceStream(new File("./loading.gif")));
}
};
private Genericdao dao = null;
DataTable<IModel> table = null;
protected Form form = null;
boolean isDataTableRefreshRequired = false;
private WebMarkupContainer wmc;
private String logLeveL;
private TextField<String> logLevelPackage;
private DropDownChoice<String> logLevelName;
AjaxButton submit;
protected ModalWindow componentWindow = new ModalWindow("componentWindow");
private ModalWindow window;
private Image loading;
@SuppressWarnings("rawtypes")
public LogLevelCreation(LogLevelSettingManagement loglevelsettingManagement, ModalWindow window, String action,
LogLevelConfigureModel loglevelModel) {
form = new Form("form");
getSession().cleanupFeedbackMessages();
if(loglevelModel!=null && loglevelModel.getLogLevelName()!=null){
logLeveL = (loglevelModel.getLogLevelName().isEmpty() ? null : loglevelModel.getLogLevelName());
}
dao = Genericdao.getInstance();
this.window=window;
prepareForm(action, loglevelModel);
}
@SuppressWarnings("unused")
private void prepareForm(final String action,final LogLevelConfigureModel loglevelModel) {
// TODO Auto-generated method stub
wmc = new WebMarkupContainer("body");
wmc.add(new AbstractBehavior() {
private static final long serialVersionUID = -8516603914734934172L;
@Override
public void bind(Component component) {
component.add(new AttributeAppender("onload", new Model<String>("setupFunc();"), ""));
super.bind(component);
}
});
final FeedbackPanel feedbackDiv = new FeedbackPanel(FEEDBACK_DIV);
form.add(feedbackDiv.setOutputMarkupId(true));
logLevelPackage = new TextField<String>("loglevelPackage", new PropertyModel<String>(loglevelModel, "logLevelPackage"));
logLevelPackage.add(ValidationMsgBehaviour.VALIDATIONMSGBEHAV);
logLevelPackage.setOutputMarkupId(true);
List<String> logLevelList=new ArrayList<String>();
logLevelList.add("DEBUG");
logLevelList.add("INFO");
logLevelList.add("WARN");
logLevelList.add("ERROR");
logLevelList.add("FATAL");
logLevelName = new DropDownChoice<String>("logLevelName", new PropertyModel<String>(loglevelModel,
"logLevelName"), logLevelList);
logLevelName.add(ValidationMsgBehaviour.VALIDATIONMSGBEHAV);
logLevelName.setOutputMarkupId(true);
if (action.equals("edit")) {
logger.info("Edit button click");
logLevelPackage.setEnabled(false);
logLevelPackage.setVisible(true);
logLevelName.setEnabled(true);
logLevelName.setVisible(true);
}else {
// TO:DO : Set visible fields
}
submit = new AjaxButton("saveEditAdd", form) {
/**
*
*/
private static final long serialVersionUID = 1594616261153407739L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> arg1) {
logger.info("## inside submit button click");
try {
if (loglevelModel != null) {
if(!validateFields()){
form.add(feedbackDiv);
feedbackDiv.setVisible(true);
target.add(form);
return;
}
addLogLevel(target);
}
} catch (SQLException e1) {
logger.error("Error while saving users data in database", e1);
getSession().cleanupFeedbackMessages();
getSession().info("Error occured while saving user's data.");
} catch (Exception e) {
logger.error("Error while saving Users Data", e);
getSession().cleanupFeedbackMessages();
getSession().info("Error occured while saving user's data.");
}
}
private boolean addLogLevel(AjaxRequestTarget target) throws Exception {
if(action.equals("add")){
try {
dao.insertObject("logLevelData", loglevelModel);
}catch (SQLException e) {
logger.info(e.getMessage());
logger.error("Error occurs at plus symbol while adding new log in datatable");
}
// Insert Data
getSession().cleanupFeedbackMessages();
getSession().info("Log levels are added successfully");
getSession().cleanupFeedbackMessages();
}else if (action.equals("edit")) {
// Update Existing Data
logger.info("Edit button click 2");
try {
dao.updateObject("logLevelData", loglevelModel);
}catch (SQLException e) {
logger.info(e.getMessage());
logger.error("Error occurs the in updating at popup edit button bootup datatable");
}
getSession().cleanupFeedbackMessages();
getSession().info("Log levels are edit/updated successfully");
}
window.close(target);
return true;
}
private boolean validateFields() {
if(loglevelModel.getLogLevelName() == null){
error("Log Level Name cannot be empty.");
return false;
}else if(loglevelModel.getLogLevelPackage() == null){
error("Log level package cannot be empty.");
return false;
}
return true;
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(form);
}
};
AjaxButton cancel = new AjaxButton("cancel", form) {
/**
*
*/
private static final long serialVersionUID = -7266817836385572901L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) { //unused
target.add(form);
}
};
loading = new Image("flyoutImg", pkgResourcereference);
loading.setMarkupId("busyImg");
loading.setOutputMarkupId(true);
loading.setOutputMarkupPlaceholderTag(true);
form.add(logLevelPackage);
form.add(logLevelName);
form.add(submit);
form.add(cancel);
wmc.add(loading);
wmc.add(form);
wmc.add(componentWindow);
wmc.add(new Label("versionNo", VersionInfo.getVersionNo()));
add(wmc);
}
abstract void setAction(String string);
@Override
public void renderHead(IHeaderResponse response) {
String themeName = com.ecs.ulf.logserver.web.Application.getThemeName();
themeName = "../" + themeName;
response.renderString("<link href=\"" + themeName + "styles/standard.css\" type=\"text/css\" rel=\"stylesheet\" />");
response.renderString("<link href=\"" + themeName + "styles/modal.css\" type=\"text/css\" rel=\"stylesheet\" />");
response.renderString("<script type=\"text/javascript\" src=\"../scripts/flyout.js\"></script>");
response.renderString("<script type=\"text/javascript\" src=\"../scripts/jquery-3.4.1.min.js\"></script>");
}
}
Всякий раз, когда я закрываю модальное окно на window.close (target). Страница LoglevelSettingManagement не может перенаправить, и я получаю сообщение об ошибке: ОШИБКА: трассировка исключения [org. apache .wicket.protocol.http.PageExpiredException] Страница с идентификатором '7' просрочена.org. apache .wicket.protocol. http.PageExpiredException: срок действия страницы с идентификатором '7' истек. в орг. apache .wicket.request.handler.PageProvider.getPageInstance (PageProvider. java: 169) в орг. apache .wicket.request.handler.ListenerInterfaceRequestHandler.getPage (ListenerInterfaceRequestHandler.) 1030 в орг. apache .wicket.request.handler.ListenerInterfaceRequestHandler.respond (ListenerInterfaceRequestHandler. java: 165) в орг. apache .wicket.request.cycle.RequestCycle $ HandlerExecutor.respond (RequestCycle: * 1034 750) в орг. apache .wicket.request.RequestHandlerStack.execute (RequestHandlerStack. java: 64) в орг. apache .wicket.request.cycle.RequestCycle.execute (RequestCycle. java: 252) в организации. apache .wicket.request.cycle.RequestCycle.processRequest (RequestCycle. java: 209) в организации. apache .wicket.request.cycle.RequestCycle.processRequestAndDetach (RequestCycle. java: 280) в орг. apache .wicket.protocol.http.WicketFilter.processRequest (WicketFilter. java: 162) в орг. apache .wicket.protocol.http.WicketFilter.doFilter (WicketFilter. java: 218) в орг. apache .catalina.core.ApplicationFilterC hain.internalDoFilter (ApplicationFilterChain. java: 193) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166)
, и приложение перенаправляется на страницу внутренней ошибки