select_productType.jsp:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/page/share/taglib.jsp" %>
<html>
<head>
<title> 类别选择 </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
<SCRIPT language=JavaScript src="/js/xmlhttp.js"></SCRIPT>
<SCRIPT language=JavaScript>
function getDicName(typeid,name){
var form = document.forms[0];
form.dicId.value = typeid;
form.dicName.value = name;
}
function checkIt(){
var form = document.forms[0];
var parform = opener.document.forms[0];
if(parform){
parform.typeid.value = form.dicId.value;
parform.v_type_name.value = form.dicName.value;
}
}
</SCRIPT>
<style>
<!--
.inputText{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
border: 1px solid #999999;
}
body {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: #666666;
}
-->
</style>
</head>
<body>
<c:set var="menuout" value=""/>
<c:forEach items="${gps}" var="gptype">
<c:set var="menuout" value="${menuout}>><a href='/baba1.1/control/product/manage.do?method=selectUI&typeid=${gptype.typeid }'>${gptype.name }</a>"></c:set>
</c:forEach>
产品类别列表,请选择分类:<br>
导航:<a href="<html:rewrite action='/control/product/manage'/>?method=selectUI">顶级目录</a>
<c:out value="${menuout }" escapeXml="false"></c:out>
<form action="" name="main" method="post">
<input type="hidden" name="dicId"/>
<input type="hidden" name="dicName"/>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<c:forEach items="${types}" var="type" varStatus="loop">
<c:if test="${fn:length(type.childtypes) > 0}">
<td>
<a href="<html:rewrite action='/control/product/manage'/>?method=selectUI&typeid=${type.typeid }"> ${type.name }</a>
</td>
</c:if>
<c:if test="${fn:length(type.childtypes) == 0}">
<td>
<input type="radio" onclick="javascript:getDicName('${type.typeid }','${type.name }')"/>${type.name}
</td>
</c:if>
<c:if test="${loop.count%5 == 0}">
</tr><tr>
</c:if>
</c:forEach>
</tr>
<br/>
</table>
<tr><td colspan="2" align="center">
<input type='button' name='create' value=" 确 认 " onClick="javascript:checkIt()">
<input type='button' name="cancel" onClick="javaScript:window.close()" value=" 取 消 ">
</td></tr>
</form>
</body>
</html>
对应的Action中的selectUI()方法:
public ActionForward selectUI(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ProductForm formbean = (ProductForm)form;
Integer typeid = formbean.getTypeid();
String wherejpql = "o.parent is null and o.visible = true";
//因为queryParams不一定存在,所以要用new Object[0]这种方式创建一个Object数组
Object[] queryParams = null;
if(typeid!= null && typeid>0){
wherejpql = "o.parent.id = ?1";
queryParams = new Object[]{typeid};
/**
* 通过typeid得到相应的产品类型的父类型,父类型的父类型,....,用来为实现导航菜单提供数据
*/
List<ProductType> gps = new ArrayList<ProductType>();
ProductType type = productTypeService.find(ProductType.class, typeid);
ProductType parent = type.getParent();
gps.add(type);
while(parent != null){
gps.add(0,parent);
parent = parent.getParent();
}
request.setAttribute("gps", gps);
}
/**
* 通过typeid得到相应的产品类型A的所有子类型,用来显示该产品类型A下拥有哪些类型
*/
List<ProductType> childtypes = productTypeService.getScrollData(ProductType.class, wherejpql, queryParams).getResultList();
//System.out.println("----------in ProductInfoManageActio------------childtypes'length is:" + childtypes.size());
request.setAttribute("types", childtypes);
return mapping.findForward("selectUI");
}
service一层就不用写了,很简单,用JPA做的。
分享到:
相关推荐
EJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action.rarEJB3+In+Action....
Android 多个service的action 相同冲突 验证demo,对应博客地址是http://blog.csdn.net/czlove110/article/details/50791390
Action,Service和Dao功能
怎样区分Action, Service 和 Dao功能.怎样区分Action, Service 和 Dao功能.
下面小编就为大家带来一篇浅谈Action+Service +Dao 功能。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
使用Struts的Action来对数据库进行增、删、改、查四项操作 <br/>1、数据库MySQL,创建数据库 Pagination MySQL.sql用来创建表结构 <br/>连接方式有两种,一种直接JDBC,一种通过连接池,代码中有说明...
我们在开发过程中经常会发生spring注入错误或失败的情况,其实Web服务器端在Action、dao、service包之内是很容易实现的,在这些包之外实现spring注入就不容易了,总是出错,其实根本原因是无法获得相应的spring上...
freemarker+action+word
Manning+-+Hibernate+In+Action+(2007) Manning+-+Hibernate+In+Action+(2007) Manning+-+Hibernate+In+Action+(2007)
struts2自定义Action实现Action接口(实现简单登录功能)
在网页上实现加减乘除功能。用html5+css3+javascript实现加减...实现一个简单的计算器。 <form action=""> <option value="+">+ <option value="-">- *">* <option value="/">/ ()" value="="> </form>
Manning+-+JMX+in+Action
Spring+in+Action.+中文版\Spring in Action. 中文版,共四部分,请全部下载后解压!
Sencha+Touch+in+Action书籍
Spring+in+Action Manning+20
Manning+-+Code+Generation+In+Action+%282003%29.part1
JUnit+in+Action中文版 JUnit实战
学习Struts+in+Action(ChineseVersion)
groovy+in+action 英文 学习groovy的好资料,实例比较多
Spring框架提供了一个容器,该容器可以管理应用程序的组件,还提供了IoC和AoP机制,实现组件之间解耦,提高程序结构的灵活性,增强系统的可维护和可扩展性。 在SSH整合开发中,利用Spring管理Service、DAO等组件,...