package com.anbow.autonet.autotype.webapp;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.anbow.autonet.autotype.service.AutoTypeService;
import com.anbow.autonet.core.model.AutoBase;
import com.anbow.autonet.core.model.AutoBrand;
import com.anbow.autonet.core.model.AutoImage;
import com.anbow.autonet.core.model.AutoProperty;
import com.anbow.autonet.core.model.AutoPropertyhelp;
import com.anbow.autonet.core.model.AutoSeries;
public class AutoBaseAction extends DispatchAction {
private AutoTypeService autoTypeService;
public void setAutoTypeService(AutoTypeService autoTypeService) {
this.autoTypeService = autoTypeService;
}
//��ѯƷ��
public ActionForward queryAutoBrandName(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
List list = this.autoTypeService.queryAllAutoBrandName();
request.setAttribute("AllAutoBrandName", list);
if(null != request.getParameter("type") && 1==Integer.parseInt(request.getParameter("type"))){
return mapping.findForward("updateSuc");
}
if(null != request.getParameter("type") && 2==Integer.parseInt(request.getParameter("type"))){
return mapping.findForward("uploadSuc");
}
return mapping.findForward("success");
}
//��ӳ��ͻ���Ϣ
public ActionForward addAutoBase(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
AutoBase autoBase = (AutoBase)form;
String seriesId = request.getParameter("seriesId");
AutoSeries autoSeries = new AutoSeries();
autoSeries.setId(Integer.parseInt(seriesId));
autoBase.setAutoSeries(autoSeries);
this.autoTypeService.addAutoType(autoBase);
response.setContentType("text/html;charset=UTF-8");
String msg = "<script language=\"javascript\">alert(\"车型基本信息添加成功!\");window.location.href=\"/AutoNet/admin/autoinfo.do?method=getAllAutoBase&page=1\";</script>";
response.getWriter().print(msg);
return null;
}
//�õ�����������Ϣ
public ActionForward getPropertyInfo(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
response.setContentType("text/html;charset=utf-8");
String selectInfo = "";
StringBuffer strb = new StringBuffer();
strb.append("<option value='0'>= = = 请选择 = = =</option>");
List propertyInfoHelp = this.autoTypeService.getPropertyInfo();
List allAutoBrandName = this.autoTypeService.queryAllAutoBrandName();
request.setAttribute("allAutoBrandName", allAutoBrandName);
if(null != request.getParameter("autoBaseID")){
int autoBaseID = Integer.parseInt(request.getParameter("autoBaseID"));
List autoPropertyInfoList = this.autoTypeService.getAutoPropertyInfoByAutoType(autoBaseID);
StringBuffer str = new StringBuffer();
str.append("<table width='60%'>");
if(!autoPropertyInfoList.isEmpty()){
for(int i=0;i<Math.ceil(autoPropertyInfoList.size()/3.0);i++){//需要修改成为循环td的
str.append("<tr>");
for(int j =0;j<3;j++){
if((3*i+j)>=autoPropertyInfoList.size()){
str.append("<td></td><td></td>");
}else{
AutoProperty autoProperty= (AutoProperty)autoPropertyInfoList.get(3*i+j);
str.append("<td align='right'><b>"+autoProperty.getPropertyName()+"</b>:</td><td>"+autoProperty.getPropertyValue()+"</td>");
}
}
str.append("</tr>");
}
//------比较 问题???
for(Iterator iter = propertyInfoHelp.iterator();iter.hasNext();){
AutoPropertyhelp autoPropertyhelp = (AutoPropertyhelp)iter.next();
for(Iterator it = autoPropertyInfoList.iterator();it.hasNext();){
AutoProperty autoProperty= (AutoProperty)it.next();
if(!autoPropertyhelp.getName().equals(autoProperty.getPropertyName())){
strb.append("<option value="+autoPropertyhelp.getName() +">"+autoPropertyhelp.getName() +"</option>");
//System.out.println("======00000======"+autoPropertyhelp.getName());
}
}
}//------比较 问题????????
selectInfo = "\"propertyInfoHelp\":\""+strb+"\"";
}else{
str.append("<tr><td width='50%'><span class='red'>暂无详细属性</span></td></tr>");
for(Iterator iter = propertyInfoHelp.iterator();iter.hasNext();){
AutoPropertyhelp autoPropertyhelp = (AutoPropertyhelp)iter.next();
strb.append("<option value="+autoPropertyhelp.getName() +">"+autoPropertyhelp.getName() +"</option>");
}
selectInfo = "\"propertyInfoHelp\":\""+strb+"\"";
}
str.append("</table>");
response.getWriter().print("({\"propertyInfoList\":\""+str+"\","+selectInfo+"})");
return null;
}
return mapping.findForward("getPropertyInfoSuc");
}
//��ӳ�����ϸ��Ϣ
public ActionForward addPropertyInfo(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
String[] names = request.getParameterValues("names");
String[] values = request.getParameterValues("values");
int autoBaseID = Integer.parseInt(request.getParameter("autoName"));
AutoBase autoBase = new AutoBase();
autoBase.setId(autoBaseID);
for(int i=0;i<names.length;i++){
AutoProperty autoProperty = new AutoProperty();
autoProperty.setAutoBase(autoBase);
autoProperty.setPropertyName(names[i]);
autoProperty.setPropertyValue(values[i]);
this.autoTypeService.addPropertyInfo(autoProperty);
}
return mapping.findForward("addPropertyInfoSuc");
}
//��ѯ���ͻ���Ϣ�б�
public ActionForward getAllAutoBase(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
List AllAutoBrandlist = this.autoTypeService.queryAllAutoBrandName();
int totalRows; // 总行数
int totalPages; // 总页数
int startRow = 0; // 当前页在数据库中的起始行
int pageSize = 2; // 每页显示的行数
if(null != request.getParameter("seriesId") && Integer.parseInt(request.getParameter("seriesId"))!=0){
totalRows = this.autoTypeService.getAutoBaseRowsBySeriesID(Integer.parseInt(request.getParameter("seriesId")));// 得到总行数
request.setAttribute("seriesId", request.getParameter("seriesId"));
request.setAttribute("brandID", request.getParameter("select2"));
}else{
totalRows = this.autoTypeService.getAutoBaseRows();// 得到总行数
}
if (totalRows % pageSize != 0) { // 通过计算得到总页数
totalPages = (totalRows / pageSize) + 1;
} else {
totalPages = totalRows / pageSize;
}
// 得到要跳转的页码 ,判断内置对象page是否为空 ,否则为1
int pageNum = request.getParameter("page") != null ? Integer.parseInt(request.getParameter("page").trim()) : 1;
if (pageNum <= 0) { // 判断得到开始的首条数据位置
pageNum = 1;
startRow = 0;
} else if (pageNum > totalPages) {
startRow = totalPages;
pageNum = totalPages;
} else {
startRow = pageSize * (pageNum - 1);
}
List AllAutoBaseBySeriesIdList =null;
if(null != request.getParameter("seriesId") && Integer.parseInt(request.getParameter("seriesId"))!=0){
AllAutoBaseBySeriesIdList = this.autoTypeService.queryAllAutoBaseBySeriesID(startRow, pageSize, Integer.parseInt(request.getParameter("seriesId")));
}else{
AllAutoBaseBySeriesIdList = this.autoTypeService.queryAllAutoBase(startRow, pageSize);
}
request.setAttribute("PageNum", pageNum);
request.setAttribute("TotalPages", totalPages)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs
资源推荐
资源详情
资源评论
收起资源包目录
ssh框架 ssh框架 ssh框架 ssh框架 ssh框架 ssh框架 ssh框架 ssh框架 (928个子文件)
spellchecker.cfm 5KB
AutoBaseAction.class 17KB
SelectRegionAction.class 12KB
CommentManagerAction.class 10KB
DealerdaoImp.class 9KB
BaseHibernateDao.class 9KB
DealerAction.class 8KB
SuperManagerDaoImp.class 7KB
AutoBase.class 6KB
UploadServlet.class 6KB
AutoTypeDaoImpl.class 6KB
SelectRegionDaoImpl.class 5KB
StringUtil.class 5KB
BrandDaoImpl.class 5KB
OfferSelectAction.class 5KB
DateUtil.class 5KB
NewsAction.class 5KB
DealerAutotypeAction.class 5KB
BrandAction.class 5KB
NewsDaoImpl.class 5KB
NewsTypeAction.class 4KB
SeriesAction.class 4KB
OfferByAuto.class 4KB
UploadAction.class 4KB
NewsAction.class 4KB
HibernateUtil.class 4KB
AutoTypeServiceImpl.class 4KB
SuperManagerServiceImp.class 4KB
AutoNews.class 4KB
AutoAdmin.class 4KB
AutoDealer.class 4KB
SelectRegionServiceImpl.class 3KB
DealerbyAuto.class 3KB
DealerbyRegion.class 3KB
Seriesbybrand.class 3KB
SeriesByBrandAction.class 3KB
BaseBySeriesAction.class 3KB
AutobySeries.class 3KB
UserNewsAction.class 3KB
NewsServiceImpl.class 3KB
CitybyPronvice.class 3KB
DealerServiceImp.class 3KB
PropertyUtil.class 3KB
DealerAutotype.class 2KB
BrandServiceImpl.class 2KB
AutoBrand.class 2KB
AutoImage.class 2KB
AutoDealeroffer.class 2KB
AutoManagerAction.class 2KB
CheckAutoTypeAction.class 2KB
SelectAutoAction.class 2KB
AutoSeries.class 2KB
CharecterFilters.class 2KB
AutoProperty.class 2KB
AdminRightAction.class 2KB
AutoRegion.class 2KB
DwrAction.class 2KB
ResourceBundleUtil.class 1KB
AdminRight.class 1KB
NewsType.class 1KB
QueryAction.class 1KB
RegionHelp.class 1KB
AutoTypeDao.class 1KB
AutoTypeService.class 1KB
SuperManagerService.class 1KB
SuperManagerDao.class 1KB
SelectRegionService.class 1KB
SelectRegionDao.class 1KB
NewsService.class 1KB
NewsDao.class 1021B
DealerService.class 981B
AutoPricerange.class 975B
AutoPropertyhelp.class 963B
GenericsUtil.class 942B
Dealerdao.class 922B
BrandService.class 798B
BrandDao.class 786B
UploadForm.class 650B
.classpath 11KB
default.css 12KB
style.css 11KB
fck_editor.css 8KB
fck_editor.css 8KB
fck_editor.css 8KB
fck_dialog.css 6KB
fck_dialog.css 6KB
fck_dialog.css 6KB
fck_internal.css 4KB
qiantai.css 4KB
fck_editorarea.css 3KB
scayt_dialog.css 2KB
common.css 2KB
fck_dialog_common.css 2KB
fck_showtableborders_gecko.css 2KB
browser.css 2KB
style.css 1KB
common.css 1KB
spellerStyle.css 890B
tablestyle.css 812B
login.css 753B
共 928 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
- 轼佣2012-09-06感觉没有什么用啊。。分还设置的那么高。。
- Java高知社区2012-07-21感觉还可以,涉及各个方面,是一个好的入门教材。
- luzhao22012-07-12感觉还可以,涉及各个方面,是一个好的入门教材
chenglinjava
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功