ResultConfig resultConfig = new ResultConfig(); String resultName = resultElement.getAttribute("name"); resultConfig.setName(resultName); String resultView = resultElement.getAttribute("view"); resultConfig.setView(resultView); String resultRedirect = resultElement.getAttribute("redirect"); if (StringUtils.isEmpty(resultRedirect)){ resultRedirect = "false"; } resultConfig.setRedirect(Boolean.parseBoolean(resultRedirect)); String viewParameter = resultElement.getAttribute("viewParameter"); if (!StringUtils.isEmpty(viewParameter)){ String [] viewParameterArr = StringUtils.split(viewParameter,","); for (String viewParameterItem : viewParameterArr) { String [] viewParameterItemArr =StringUtils.split(viewParameterItem, ":"); String key = viewParameterItemArr[0].trim(); String from = "attribute"; if (viewParamterItemArr.length == 2){ from = viewParameterItemArr[1].trim(); } ViewParameterConfig viewParameterConfig = new ViewParameterConfig(); resultConfig.addViewParameterConfig(viewParameterConfig); } } actionConfig.addResult(resultName,resultConfig);
ResultConfig
private String name; private String view; private boolean redirect; private List<ViewParameterConfig> viewParameterConfigs = new ArrayList<>(); public void addViewParameterConfig(ViewParameterConfig viewParameterConfig){ this.viewParameterConfigs.add(viewParameterConfig); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getView() { return view; } public void setView(String view) { this.view = view; } public boolean isRedirect() { return redirect; } public void setRedirect(boolean redirect) { this.redirect = redirect; } public List<ViewParameterConfig> getViewParameterConfigs() { return viewParameterConfigs; } public void setViewParameterConfigs(List<ViewParameterConfig> viewParameterConfigs) { this.viewParameterConfigs = viewParameterConfigs; }
ViewParameterConfig
private String name; private String from; public ViewParameterConfig() { } public ViewParameterConfig(String name, String from) { this.name = name; this.from = from; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; }