Java tutorial
/* * @(#)Viewer.java 2011-12-27 * ?us?? 2008-2011, Inc. All rights reserved. * s.server. Use is subject to license terms. */ package com.us.action.view; import java.io.File; import java.util.Map; import lombok.Getter; import lombok.Setter; import org.apache.commons.io.FileUtils; import com.us.action.Action; import com.us.config.AppConfig; import com.us.i118.I118Helper; import com.us.util.ObjHelper; /** * ?????,?? * * @author <a href="mailto:monlyu.hong@gmail.com">monlyu</a> * @version 1.0.8, 2011-12-27 * @since JDK6.0 */ @Setter @Getter public class Viewer extends Action { private String target; private String content; private String title; @Override public String execute() throws Exception { Object kv = AppConfig.getArg(target); if (kv != null) { Map<String, Object> data = ObjHelper.toMap(kv); Object ti = data.get("title"); if (ti != null) { title = I118Helper.i118Val(ti.toString(), getRequest()); } Object cont = data.get(local()); if (cont != null) { content = FileUtils.readFileToString(new File(cont.toString()), "UTF-8"); } final Object webModel = data.get("webModel"); if (webModel != null) { getRequest().setAttribute("webModel", webModel); } } return view("showAll"); } }