`
uule
  • 浏览: 6351810 次
  • 性别: Icon_minigender_1
  • 来自: 一片神奇的土地
社区版块
存档分类
最新评论

农产品项目公共类WWAction.java

阅读更多

WWAction.java:

public class WWAction extends ActionSupport implements SessionAware {
	protected final Logger logger = Logger.getLogger(getClass());
	protected Page webpage;

	protected Map session = null;

	protected List msgs = new ArrayList();

	protected Map urls = new HashMap();

	protected static final String MESSAGE = "message";

	protected static final String JSON_MESSAGE = "json_message";

	protected String script = "";

	protected String json;
 
	protected int page;

	protected int pageSize;

	// 页面id,加载页面资源所用
	protected String pageId;
       ....
}
 

GoodAction.java:(该类继承WWAction.java)

	public String saveAdd() {

		try {
			goodsManager.add(goods);
			this.msgs.add("商品添加成功");
			this.urls.put("商品列表", "goods!list.do");
		} catch (RuntimeException e) {
			e.printStackTrace();
			this.msgs.add(e.getMessage());
		}

		return this.MESSAGE;
	}

message.jsp页面:

<div    class='success'>
	<c:forEach var="msg" items="${msgs}">
	  <h4>${msg }</h4>
	</c:forEach>     
  <div style="clear:both;"> 
  <c:forEach var="url" items="${urls}">       
    <a href="${url.value}" target="_self" >
    	返回${url.key}  </a>
    </c:if>
    </c:forEach>
   </div>
</div>

 1

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics