软件工程短学期实践第三次随笔

软件工程短学期实践即将接近尾声,我们的软件工程项目也已趋于完成。

软件工程短学期实践项目:

这是一个简单的客户信息管理维护软件,它能把客户编号、客户姓名、客户电话和客户性别保存在数据库之中,我们可以在数据库中查询保存的客户信息,还可以随时修改以及删除客户信息。

随后,我们在老师的指导下,开始自己修改设计软件,我做的是库存管理项目,代码如下:

package com.crm.action;

import java.util.Map;

import com.crm.bean.Item;
import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class FindItemByCdtAction extends ActionSupport {

        private Item item;
        private ItemService findCdtService;
        public Item getItem() {
            return item;
        }
        public void setItem(Item item) {
            this.item = item;
        }
        public ItemService getFindCdtService() {
            return findCdtService;
        }
        public void setFindCdtService(ItemService findCdtService) {
            this.findCdtService = findCdtService;
        }
        @SuppressWarnings({ "unchecked", "unchecked" })
        @Override
        public String execute() throws Exception {
            // TODO Auto-generated method stub
            Map map=(Map)ActionContext.getContext().get("request");
            map.put("list", this.findCdtService.findItemByCondition(item));
            return SUCCESS;
        }

    }
package com.crm.action;

import java.io.InputStream;

import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionSupport;

public class GenerateExcelAction extends ActionSupport{
    private ItemService excelService;
    public  ItemService getExcelService(){
        return excelService;
    }
    public void setExcelService(ItemService excelService){
        this.excelService =excelService;
    }
    public InputStream getDownloadFile(){
        return this.excelService.getInputStream();

    }
    @Override
    public String execute() throws Exception{
        //TODO Auto-generated method stub
        return SUCCESS;
    }

}
package com.crm.action;

import com.crm.bean.Item;
import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionSupport;

public class ItemSaveAction extends ActionSupport {
    private ItemService service;
    private Item item;
    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public ItemService getService() {
        return service;
    }

    public void setService(ItemService service) {
        this.service = service;

    }

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub
        this.service.saveItem(item);

        return SUCCESS;
    }

}
package com.crm.action;

import java.util.Map;

import com.crm.bean.Item;
import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ListItemAction extends ActionSupport {

        private ItemService service;
        private Item item;
        public void setService(ItemService service)
        {
            this.service=service;
        }
        @Override
        public String execute() throws Exception {
            // TODO Auto-generated method stub
            Map map=(Map)ActionContext.getContext().get("request");
            map.put("list", this.service.findAllItem());

            return SUCCESS;
        }
        public Item getItem() {
            return item;
        }
        public void setItem(Item item) {
            this.item = item;
        }

    }
package com.crm.action;

import com.crm.bean.Item;
import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionSupport;

public class RemoveItemAction extends ActionSupport {

        private Item item;
        private ItemService service;
        public Item getItem() {
            return item;
        }
        public void setItem(Item item) {
            this.item = item;
        }
        public ItemService getService() {
            return service;
        }
        public void setService(ItemService service) {
            this.service = service;
        }
        @Override
        public String execute() throws Exception {
            // TODO Auto-generated method stub
            this.service.removeItem(item);
            return SUCCESS;
        }

    }
package com.crm.action;

import java.util.ArrayList;
import java.util.List;

import com.crm.bean.Item;
import com.crm.service.ItemService;
import com.opensymphony.xwork2.ActionSupport;

public class UpdateItemAction extends ActionSupport {

        /**
         *
         */
        private static final long serialVersionUID = 1L;
        private ItemService updateItemService;
        private Item item;

        public ItemService getUpdateItemService() {
            return updateItemService;
        }
        public void setUpdateCustService(ItemService updateItemService) {
            this.updateItemService = updateItemService;
        }

        public Item getItem() {
            return item;
        }

        public void setItem(Item item) {
            this.item = item;
        }

        public String execute() throws Exception {
            // TODO Auto-generated method stu b
            //this.customer.setCustsex(this.strList.get(0).toString());
            if(item != null){
                this.updateItemService.updateItem(item);
                return SUCCESS;
            }else{
                return "";
            }

        }
    }
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="textml; charset=ISO-8859-1">
<title>库存管理</title>
<style>
.divcss5{width:600px;height:120px;border:1px solid #000;margin:20px;padding:10px;}
body,table{
font-size:12px;
}
table{
table-layout:fixed;
empty-cells:show;
border-collapse: collapse;
margin:0 auto;
}
td{
height:30px;
}
h1,h2,h3{
font-size:12px;
margin:0;
padding:0;
}
.table{
border:1px solid #000;
color:#000;
margin:20px;
}
.table th {
background-repeat:repeat-x;
height:30px;
}
.table td,.table th{
border:1px solid #000;
padding:0 1em 0;
}
.table tr.alter{
background-color:#000;
}
input{
margin:8px;
}
</style>

 <script language="JavaScript" type="text/javascript">
 function openwind(){
    feature="dialogWidth:650px;dialogHeight:200px;status:no;help:no;scrollbars:no;dialogTop:150;";
    window.showModalDialog("custSave.jsp",null,feature);
 };
 function funDelete(){
    if(confirm(‘确定要执行此操作吗?‘)){
        return true;
    }else{
        return false;
    }
 }
  function updatewindow(){
    feature="dialogWidth:650px;dialogHeight:200px;status:no;help:no;scrollbars:no;dialogTop:150;";
    window.showModalDialog("custUpdate.jsp",null,feature);       

    function funExcel(){
    location.href=‘generateExcel.action‘;
    }
 };

</script>
</head>

<body>

    <CENTER>
    <center><div><font color="red" size="6">库存管理</font></div></center>
    <div style="width:20px"></div>
    <div class="divcss5" id="div1">
    <s:form action="listCust" theme="simple">
    <div style="width:10px"></div>
        商品编号:<s:textfield name="item.itemnumber"    label="itemnumber" id="txt1"></s:textfield>
        商品名称:<s:textfield name="item.itemname"  label="itemname" id="txt2"></s:textfield><br>
        商品数量:<s:textfield name="item.itemamount"   label="itemnumber" id="txt3"></s:textfield>
        商品种类:<s:textfield name="item.itemvariety" label="itemvariety" id="txt4"></s:textfield><br>
        <div style="width:20px"></div>
        <input width="100" type = "button" id = "add" name = "btn" value="入库" onClick="openwind()"/>
        <s:submit  action="findCdt" value="查询">  </s:submit>
        <input width="100" type = "button" id = "rtn" name = "btn" value="返回" onClick="history.go(-1)"/>
        <input width="100" type = "button" value="生成excel" onClick="funExcel();"/>
    </s:form>
    </div>
    <div style="width:20px"></div>
    <table border="1" width="47%" class="table">
        <tr>
         <td>商品编号</td>
         <td>名称</td>
         <td>品种</td>
         <td>数量</td>
         <td>经办人</td>
         <td>进货渠道</td>
         <td>入库时间</td>
         <td width="80">操作</td>
        </tr>
        <s:iterator value="#request.list" id="item">
          <tr>
           <td><s:property value="#item.itemnumber"/></td>
           <td><s:property value="#item.itemname"/></td>

           <td>
           <s:if test="#item.itemvariety == 1">
           <s:property value="‘日用品‘"/>
           </s:if>
           <s:elseif test="#item.itemvariety == 2">
           <s:property value="‘数码科技‘"/>
           </s:elseif>
           <s:elseif test="#item.itemvariety == 3">
           <s:property value="‘其他‘"/>
           </s:elseif>
           </td>

           <td><s:property value="#item.age"/></td>
           <td><s:property value="#item.itemamount"/></td>
           <td><s:property value="#item.position"/></td>
           <td><s:property value="#item.importdate"/></td>
           <td>
           <s:a href="updatePreviewitem.action?item.id=%{#item.id}">出库</s:a>
           <s:a href="deleteitem.action?item.id=%{#item.id}" onClick="return funDelete();">下架</s:a>
           </td>
          </tr>
        </s:iterator>
    </table>
    </CENTER>
</body>
<html>
时间: 2024-08-09 10:24:21

软件工程短学期实践第三次随笔的相关文章

软件工程短学期实践第一次随笔

在所有科目期末考试之后,我们开始了我们为期两周的短学期软件工程实践,在软件工程实践课上,老师悉心教导我们.第一天老师帮助我们下载java软件.Navicat Premium等软件,还帮助我们配置了java环境,使我们每一个同学可以在自己的电脑上编写以及运行java程序.随后我们跟着老师一起学习一起实践,开始编写主要代码,设计界面. 首先我们用Navicat Premium建立了一个数据库Cust: 有id,custno,custname,telephone,sex等属性 然后,我们开始用Myec

软件工程短学期实践第二次随笔

我们这几天的软件工程实践在老师的带领指导下,一步一步走向成功.老师带领我们一起写代码,帮助我们找错误,争取解决每一个问题. 我们开始学着编写applicationContext.xml文件: 还学会了编写jsp文件: 还编写了index.jsp文件: 经过了这几天的学习我受益匪浅,在编写代码运行的时候发现错误我会请教老师或者上网自行百度结果,我觉得这样的实践课程很有意义,即学到了知识,也培养了我们动手能力.

暑期完善 短学期实践工程 内容记录一

因先前一直在备考雅思,前不久刚刚告一段落,最近终于有时间把短学期内的工程内容捡起来完善.因为时隔已久不少技术性的内容遗忘情况还是挺重的. 近期主要优化完善了登录/注册页面的代码,添加了背景图片和一些细节上的改动,增加了返回主界面的按钮,修复了登录.注册两个功能块有时不能跳转的BUG,更改了使用的CSS样式并解决了有时样式不能正常显示等问题 下面附上代码 <login.jsp> <head> <base href="<%=basePath%>"&

实践第三次随笔作业

软件开发流程不光指团队的流程,还包括个人开发流程,因为软件团队是由个人组成的.在团队的大流程中,是每一个具体的个人在做开发,测试,用户界面设计,管理,交流等工作.因此个人在团队中也有独立的流程.把每个人的工作有序的组织起来,就是团队的流程,单个成员称为Individual Contributor(IC),IC在团队中的流程有如下几样: 通过交流,实验,快速原型等方法,理解问题,任务和需求 提出多种解决办法并评估工作量,其中包括寻找以前的解决方案,因为很多工作是重复性的 与相关角色交流解决问题提案

软工小学期实践1

这次的短学期,是在老师的带领下做一个客户信息管理系统,使用的工具主要是MyEclipse和Navicat Premium.在安装配置环境.写代码和运行时都出现了一些问题. 第一天是安装和配置环境.我们在安装好了MyEclipse以后,打不开这个软件,显示有错.卸载了以后重装还是显示有错.后来在同学的帮助下我们明白了,MyEclipse的安装目录里不可以有中文,不然就打开运行的时候就会出错. 第二天我们安装了Navicat Premium并连接了数据库,在这过程中,我也遇到了一个卡了很久的问题.在

软件工程小学期经历part1

小学期实践已经过去了三天了,这三天我们经历了改环境,装软件,写代码等多部环节,其中也遇到了一些问题,今天就遇到了这样的一个问题 虽然能够顺利的构成网站页面,输入的数据也能够输入到数据库里,但输入之后 网站依旧会出错跳转到这样的页面,希望之后的实践能找到方法来解决

短学期实训——第一篇

短学期的第一天,东软的李老师让我们安装两个环境,在安装过程当中,虽然遇到很多的小困难,老师还是 耐心的为我们每位同学解决困难. , 终于在下午我们完成了第一项任务 在第二天我们 开始编写程序 虽然在运行过程中我们每个人的编辑环境都出现了问题,但是在老师的耐心指导下我们终于将此环境运行成功 利用这三天的时间,我深刻体会到了用户的体验,我们所编写的软件是针对用户而言的,我们应当 考虑到用户体验的各种角度,首先就是用户的第一印象,在这里我们要考虑以下两点,第一点就是谁会是我们的目标用户,第二点就是用户

短学期知识总结(一)

本次的短学期学习,我的收获很多,学习了很多以往都不曾了解的知识.以下是短学期中所讲的部分知识点: Springmvc的概念:springmvc是spring框架的一个模块,springmvc和spring无需通过中间整合层进行整合.它是一个基于mvc的web框架. MVC在B/S系统下的应用: 1>     用户发起request 请求至控制器 控制接收用户请求的数据,委托给模型进行处理 2>     控制器通过模型处理数据并得到处理结果 模型通常是指业务逻辑 3>     模型处理结果

短学期知识总结(二)

在本次的短学期当中,我学到了拦截器的一些相关知识,可以说是非常实用的,也是大部分做网页的都必须涉及的.以下为拦截器的相关知识: Spring Web MVC的处理器拦截器类似于Servlet开发中的过滤器Filter,用于对处理器进行预处理和后处理. 定义拦截器: 实现HandlerInterceptor接口 接口中提供三个方法(preHandle,postHandle,afterHandle) 配置拦截器 Springmvc拦截器针对HandlerMapping中配置拦截,经过该Handler