此文为转载
用实例见证smartclient的厉害吧。
- 先貼出來圖片炫炫!很閃吧。
- 建表語句:
- createtablesupplyItem(
- itemIDintprimarykeyidentity(1,1),
- itemNamevarchar(300),
- unitCostdecimal(28,2),--55.23
- SKUvarchar(30),
- descriptionvarchar(5000),
- categoryvarchar(128),
- inStockvarchar(30),
- unitsvarchar(30),
- nextShipmentdatetime
- )
- --droptablesupplyCategory
- createtablesupplyCategory(
- categoryNamevarchar(128)primarykey,
- parentIDvarchar(255),
- )
- demoAppJS.jsp
- Jsp代碼:
- <!--------------------------------------------------------------------
- 整合人:舒婷*_*
- ---------------------------------------------------------------------->
- <HTML>
- <HEAD>
- <TITLE>SmartClientDemoApplication</TITLE>
- <metahttp-equiv="pragma"content="no-cache">
- <metahttp-equiv="cache-control"content="no-cache">
- <metahttp-equiv="expires"content="0">
- <metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
- <metahttp-equiv="description"content="Thisismypage">
- <SCRIPT>varisomorphicDir="isomorphic/";</SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_History.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_Core.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_Foundation.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_Containers.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_Grids.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_Forms.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/ISC_DataBinding.js></SCRIPT>
- <SCRIPTSRC=smartclient/modules/load_skin.js></SCRIPT>
- </HEAD>
- <BODYCLASS="pageBackground"STYLE="overflow:hidden">
- <scriptsrc="demoAppJS.js"></script>
- </BODY>
- </HTML>
- demoAppJS.js
- isc.setAutoDraw(false);
- //<isomorphic:loadDSname="supplyItem"/>
- //<isomorphic:loadDSname="supplyCategory"/>
- isc.DataSource.create({
- ID:"supplyCategory",
- dataFormat:"xml",
- recordXPath:"//country",
- fields:[
- {name:"categoryName",primaryKey:true},
- {foreignKey:"supplyCategory.categoryName",//这一步不懂、??
- hidden:true,
- name:"parentID",
- required:true,
- rootValue:"root",//初始化加载parentID为root记录如果没有设置rootValue会出现死循环式的树
- type:"text"
- }
- ],
- operationBindings:[
- {
- operationType:"fetch",
- dataURL:"demoApp/findTreeAll.action"
- }
- ]
- });
- isc.DataSource.create({
- ID:"supplyItem",
- dataFormat:"xml",//数据格式xml格式
- recordXPath:"//country",//--<country></country>
- fields:[
- //{name:"itemId",primaryKey:true},//countryCode設置為主鍵
- {name:"itemName",title:"itemName"},
- {name:"unitCost",title:"unitCost"},
- {name:"SKU",title:"SKU"},
- {name:"description",title:"description"},
- {name:"category",title:"category"},
- {name:"inStock",title:"inStock"},
- {name:"nextShipment",title:"nextShipment"}
- ],
- operationBindings:[
- {operationType:"fetch",
- dataURL:"demoApp/findAll.action"
- },
- {operationType:"add"
- //dataURL:"country/insertInfo.action"
- },
- {operationType:"update"
- //dataURL:"country/updateInfo.action"
- },
- {operationType:"remove"
- //dataURL:"country/deleteInfo.action"
- }
- ]
- });
- isc.Page.setAppImgDir(isc.Page.getIsomorphicDocsDir()+"exampleImages/");//设置img文件路径
- isc.TreeGrid.create({
- ID:"categoryTree",
- dataSource:"supplyCategory",
- nodeClick:"findForm.findItems(node.categoryName)",
- showHeader:false,
- leaveScrollbarGap:false,
- animateFolders:true,
- canAcceptDroppedRecords:true,
- canReparentNodes:false,
- selectionType:"single",
- animateRowsMaxTime:750
- });
- isc.HTMLPane.create({
- ID:"helpCanvas",
- contentsURL:"demoApp_helpText.html",
- overflow:"auto",
- styleName:"defaultBorder",
- padding:10
- });
- isc.IButton.create({
- ID:"findButton",
- title:"Find",
- left:25,
- top:16,
- width:80,
- click:"findForm.findItems()",
- icon:"demoApp/icon_find.png",
- iconWidth:24
- });
- isc.SearchForm.create({
- ID:"findForm",
- dataSource:supplyItem,
- left:130,
- top:10,
- cellPadding:4,
- numCols:6,
- fields:[
- {name:"SKU"},
- {name:"itemName",editorType:"comboBox",optionDataSource:"supplyItem",
- pickListWidth:250},
- {name:"findInCategory",editorType:"checkbox",
- title:"Usecategory",defaultValue:true,shouldSaveValue:false}
- ],
- //Functiontoactuallyfinditems
- findItems:function(categoryName){
- varfindValues;
- if(this.getValue('findInCategory')&&categoryTree.selection.anySelected()){
- //usetreecategoryandformvalues
- if(categoryName==null)categoryName=categoryTree.getSelectedRecord().categoryName;
- findValues={category:categoryName};
- isc.addProperties(findValues,this.getValues());
- }elseif(categoryName==null){
- //useformvaluesonly
- findValues=this.getValues();
- }else{
- //usetreecategoryonly
- findValues={category:categoryName};
- }
- itemList.filterData(findValues);
- itemDetailTabs.clearDetails();
- }
- });
- isc.ListGrid.create({
- ID:"itemList",
- dataSource:supplyItem,
- useAllDataSourceFields:true,
- fields:[
- {name:"itemName",title:"Name",showHover:true},
- {name:"unitCost",
- formatCellValue:"returnisc.Format.toCurrencyString(parseFloat(value))",
- editorType:"spinner",editorProperties:{step:0.01}},
- {name:"SKU",canEdit:false},
- {name:"description",showHover:true},
- {name:"category",canEdit:false},
- {name:"inStock",width:55,align:"center",
- formatCellValue:function(value,record,field,rowNum,colNum){
- if(value)returnisc.Canvas.imgHTML("demoApp/checked.png",13,13);
- elsereturnisc.Canvas.imgHTML("demoApp/unchecked.png",13,13)
- }},
- {name:"nextShipment",showIf:"false"}
- ],
- recordClick:"this.updateDetails()",
- canEdit:true,
- modalEditing:true,
- cellChanged:"this.updateDetails()",
- alternateRecordStyles:true,
- canDragRecordsOut:true,
- hoverWidth:200,
- hoverHeight:20,
- selectionType:"single",
- cellContextClick:"returnitemListMenu.showContextMenu()",
- updateDetails:function(){
- varrecord=this.getSelectedRecord();
- if(record==null)returnitemDetailTabs.clearDetails();
- if(itemDetailTabs.getSelectedTabNumber()==0){itemViewer.setData(record)
- }else{
- itemDetailTabs.updateTab("editTab",editForm);
- editForm.editRecord(record);
- }
- }
- });
- isc.Menu.create({
- ID:"itemListMenu",
- cellHeight:22,
- data:[
- {title:"AddNewItem",
- icon:"demoApp/icon_add.png",
- click:function(){
- itemList.selection.deselectAll();
- itemDetailTabs.selectTab(1);
- itemList.updateDetails();
- }
- },
- {isSeparator:true},
- {title:"ShowDetails",
- icon:"demoApp/icon_view.png",
- click:"itemDetailTabs.selectTab(0);itemList.updateDetails()"},
- {title:"EditItem",
- icon:"demoApp/icon_edit.png",
- click:"itemDetailTabs.selectTab(1);itemList.updateDetails()"},
- {title:"DeleteItem",
- icon:"demoApp/icon_delete.png",
- click:"itemList.removeSelectedData();itemDetailTabs.clearDetails()"}
- ]
- });
- isc.DetailViewer.create({
- ID:"itemViewer",
- dataSource:supplyItem,
- width:"100%",
- margin:"25",
- emptyMessage:"Selectanitemtoviewitsdetails"
- });
- isc.DynamicForm.create({
- ID:"editForm",
- dataSource:supplyItem,
- useAllDataSourceFields:true,
- fields:[
- {name:"SKU"},
- {name:"description",editorType:"textArea",rowSpan:3,width:200},
- {name:"category",editorType:"pickTree",dataSource:supplyCategory,//无法显示editform
- emptyMenuMessage:"NoSubCategories",canSelectParentItems:true},
- {name:"unitCost",editorType:"spinner",step:0.01},
- {name:"inStock"},
- {name:"nextShipment",useTextField:true,editorType:"date"},
- {name:"savebtn",editorType:"button",align:"center",
- width:100,colSpan:4,title:"SaveItem",click:"editForm.saveData()"}
- ],
- width:650,
- numCols:4,
- colWidths:[100,200,100,200],
- margin:25,
- cellPadding:5,
- autoFocus:false
- });
- isc.Label.create({
- ID:"editorMessage",
- autoDraw:false,
- width:"100%",
- height:"100%",
- align:"center",
- contents:"Selectarecordtoedit,oracategorytoinsertanewrecordinto"
- });
- isc.TabSet.create({
- ID:"itemDetailTabs",
- tabs:[
- {title:"View",pane:itemViewer,ID:"viewTab",width:70,icon:"demoApp/icon_view.png"},
- {title:"Edit",pane:editForm,ID:"editTab",width:70,icon:"demoApp/icon_edit.png"}
- ],
- tabSelected:"itemList.updateDetails()",
- clearDetails:function(){
- varselectedTab=this.getSelectedTabNumber();
- if(selectedTab==0){
- itemViewer.setData();
- }elseif(selectedTab==1){
- if(categoryTree.getSelectedRecord()!=null){
- this.updateTab("editTab",editForm);
- editForm.editNewRecord({category:categoryTree.getSelectedRecord().categoryName});
- }else{
- this.updateTab("editTab",editorMessage);
- }
- }
- }
- });
- //Defineapplicationlayout
- //---------------------------------------------------------------------
- isc.HLayout.create({
- ID:"pageLayout",
- width:"100%",
- height:"100%",
- layoutMargin:20,
- members:[
- isc.SectionStack.create({
- ID:"leftSideLayout",
- width:280,
- showResizeBar:true,
- visibilityMode:"multiple",
- animateSections:true,
- sections:[
- {title:"OfficeSupplyCategories",autoShow:true,items:[categoryTree]},
- {title:"Instructions",autoShow:true,items:[helpCanvas]}
- ]
- }),
- isc.SectionStack.create({
- ID:"rightSideLayout",
- visibilityMode:"multiple",
- animateSections:true,
- sections:[
- {title:"FindItems",autoShow:true,items:[
- isc.Canvas.create({
- ID:"findPane",
- height:60,
- overflow:"auto",
- styleName:"defaultBorder",
- children:[findForm,findButton]
- })
- ]},
- {title:"OfficeSupplyItems",autoShow:true,items:[itemList]},
- {title:"ItemDetails",autoShow:true,items:[itemDetailTabs]}
- ]
- })
- ]
- });
- isc.Page.setEvent("load","pageLayout.draw()");
- //Customlogic:
- //Whenshowingoptionsinthecombo-box,onlyshowtheoptionsfromtheselectedcategory
- //ifappropriate
- findForm.getItem("itemName").addProperties({
- getPickListFilterCriteria:function(){
- varcriteria=this.Super("getPickListFilterCriteria",arguments);
- if(this.form.getValue('findInCategory')&&categoryTree.selection.anySelected()){
- criteria.category=categoryTree.getSelectedRecord().categoryName;
- }
- returncriteria
- }
- });
- categoryTree.fetchData();
- java代碼
- DAO層
- packageisc.java.Dao;
- importisc.java.Module.supplyItem;
- importjava.util.List;
- importorg.hibernate.SessionFactory;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.orm.hibernate3.HibernateTemplate;
- importorg.springframework.stereotype.Repository;
- @Repository
- publicclasssupplyItem_Dao{
- privateHibernateTemplatehibernateTemplate;
- @SuppressWarnings("unused")
- @Autowired
- privatevoidsetHibernateTemplate(SessionFactorysessionFactory){
- this.hibernateTemplate=newHibernateTemplate(sessionFactory);
- }
- /*
- *functionfindAll
- *查询supplyItem表中所有记录
- *并以list形式返回
- *
- **/
- @SuppressWarnings("unchecked")
- publicList<supplyItem>findAll(Stringcategory){
- Stringhql="fromsupplyItemwherecategory='"+category+"'";
- Listlist=this.hibernateTemplate.find(hql);
- returnlist;
- }
- /*
- *根据category返回对应的记录
- **/
- @SuppressWarnings("unchecked")
- publicsupplyItemfindInfoByID(intitemID){
- supplyItemsupp=(supplyItem)this.hibernateTemplate.get(supplyItem.class,itemID);
- returnsupp;
- }
- /*
- *删除指定记录
- *
- **/
- publicvoiddeleteInfo(supplyItemsupp){
- this.hibernateTemplate.delete(supp);
- }
- /*
- *更新修改后的记录
- **/
- publicvoidupdateInfo(supplyItemsupp){
- this.hibernateTemplate.update(supp);
- }
- /*
- *增加记录
- **/
- publicvoidinsertInfo(supplyItemsupp){
- this.hibernateTemplate.save(supp);
- }
- }
- packageisc.java.Dao;
- importisc.java.Module.supplyCategory;
- importjava.util.List;
- importorg.hibernate.SessionFactory;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.orm.hibernate3.HibernateTemplate;
- importorg.springframework.stereotype.Repository;
- @Repository
- publicclasssupplyCategory_Dao{
- privateHibernateTemplatehibernateTemplate;
- @SuppressWarnings("unused")
- @Autowired
- privatevoidsetHibernateTemplate(SessionFactorysessionFactory){
- this.hibernateTemplate=newHibernateTemplate(sessionFactory);
- }
- @SuppressWarnings("unchecked")
- publicList<supplyCategory>findAll(StringparentId){
- Stringhql="fromsupplyCategorywhereparentId='"+parentId+"'";
- Listlist=this.hibernateTemplate.find(hql);
- returnlist;
- }
- }
- ENTITY層
- packageisc.java.Module;
- importjavax.persistence.Column;
- importjavax.persistence.Entity;
- importjavax.persistence.Id;
- importjavax.persistence.Table;
- @Entity
- @Table(name="supplyCategory")
- publicclasssupplyCategory{
- privateStringcategoryName;
- privateStringparentId;
- @Id
- @Column(name="categoryName")
- publicStringgetCategoryName(){
- returncategoryName;
- }
- publicvoidsetCategoryName(StringcategoryName){
- this.categoryName=categoryName;
- }
- @Column(name="parentId")
- publicStringgetParentId(){
- returnparentId;
- }
- publicvoidsetParentId(StringparentId){
- this.parentId=parentId;
- }
- }
- packageisc.java.Module;
- importjavax.persistence.Column;
- importjavax.persistence.Entity;
- importjavax.persistence.GeneratedValue;
- importjavax.persistence.Id;
- importjavax.persistence.Table;
- @Entity
- @Table(name="supplyItem")
- publicclasssupplyItem{
- privateintitemID;
- privateStringitemName;
- privatedoubleunitCost;
- privateStringSKU;
- privateStringdescription;
- privateStringcategory;
- privateStringinStock;
- privateStringnextShipment;
- @Id
- @GeneratedValue
- @Column(name="itemID")
- publicintgetItemID(){
- returnitemID;
- }
- publicvoidsetItemID(intitemID){
- this.itemID=itemID;
- }
- @Column(name="itemName")
- publicStringgetItemName(){
- returnitemName;
- }
- publicvoidsetItemName(StringitemName){
- this.itemName=itemName;
- }
- @Column(name="unitCost")
- publicdoublegetUnitCost(){
- returnunitCost;
- }
- publicvoidsetUnitCost(doubleunitCost){
- this.unitCost=unitCost;
- }
- @Column(name="SKU")
- publicStringgetSKU(){
- returnSKU;
- }
- publicvoidsetSKU(Stringsku){
- SKU=sku;
- }
- @Column(name="description")
- publicStringgetDescription(){
- returndescription;
- }
- publicvoidsetDescription(Stringdescription){
- this.description=description;
- }
- @Column(name="category")
- publicStringgetCategory(){
- returncategory;
- }
- publicvoidsetCategory(Stringcategory){
- this.category=category;
- }
- @Column(name="instock")
- publicStringgetInStock(){
- returninStock;
- }
- publicvoidsetInStock(StringinStock){
- this.inStock=inStock;
- }
- @Column(name="nextShipment")
- publicStringgetNextShipment(){
- returnnextShipment;
- }
- publicvoidsetNextShipment(StringnextShipment){
- this.nextShipment=nextShipment;
- }
- }
- Service層
- packageisc.java.Service;
- importisc.java.Dao.supplyCategory_Dao;
- importisc.java.Module.supplyCategory;
- importjava.util.List;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.stereotype.Service;
- importorg.springframework.transaction.annotation.Transactional;
- @Service
- publicclasssupplyCategory_Service{
- privatesupplyCategory_DaosupplyCategory_dao;
- @Autowired
- publicvoidsetSupplyCategory_dao(supplyCategory_DaosupplyCategory_dao){
- this.supplyCategory_dao=supplyCategory_dao;
- }
- @Transactional("demoApp")
- publicList<supplyCategory>findAll(StringparentId){
- returnthis.supplyCategory_dao.findAll(parentId);
- }
- }
- packageisc.java.Service;
- importisc.java.Dao.supplyItem_Dao;
- importisc.java.Module.supplyItem;
- importjava.util.List;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.stereotype.Service;
- importorg.springframework.transaction.annotation.Transactional;
- @Service
- publicclasssupplyItem_Service{
- privatesupplyItem_DaosupplyItem_dao;
- @Autowired
- publicvoidsetSupplyItem_dao(supplyItem_DaosupplyItem_dao){
- this.supplyItem_dao=supplyItem_dao;
- }
- /*
- *使用声明式事物管理
- *在业务方法上进行@Transactional注解
- *将事物规则应用到业务逻辑中
- *demoApp为限定词*_*
- **/
- @Transactional("demoApp")
- publicList<supplyItem>findAll(Stringcategory){
- returnthis.supplyItem_dao.findAll(category);
- }
- @Transactional("demoApp")
- publicsupplyItemfindInfoByID(intitemID){
- returnthis.supplyItem_dao.findInfoByID(itemID);
- }
- @Transactional("demoApp")
- publicvoiddeleteInfo(intitemID){
- supplyItemsupp=this.supplyItem_dao.findInfoByID(itemID);
- this.supplyItem_dao.deleteInfo(supp);
- }
- @Transactional("demoApp")
- publicvoidupdateInfo(supplyItemsupp){
- this.supplyItem_dao.updateInfo(supp);
- }
- @Transactional("demoApp")
- publicvoidinsertInfo(supplyItemsupp){
- this.supplyItem_dao.insertInfo(supp);
- }
- }
- Web層
- packageisc.java.Web;
- importisc.java.Module.supplyCategory;
- importisc.java.Service.supplyCategory_Service;
- importjava.io.IOException;
- importjava.util.Enumeration;
- importjava.util.Iterator;
- importjava.util.List;
- importjavax.servlet.ServletOutputStream;
- importjavax.servlet.http.HttpServletRequest;
- importjavax.servlet.http.HttpServletResponse;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.stereotype.Controller;
- importorg.springframework.web.bind.annotation.RequestMapping;
- @Controller
- publicclasssupplyCategory_Controller{
- privatesupplyCategory_ServicesupplyCategory_service;
- @Autowired
- publicvoidsetSupplyCategory_service(
- supplyCategory_ServicesupplyCategory_service){
- this.supplyCategory_service=supplyCategory_service;
- }
- @SuppressWarnings("unchecked")
- @RequestMapping(value="demoApp/findTreeAll.action")
- publicvoidfindAll(HttpServletResponseresponse,HttpServletRequestrequest){
- StringparentId=request.getParameter("parentID");
- List<supplyCategory>list=this.supplyCategory_service.findAll(parentId);
- ServletOutputStreamsos=null;
- try{
- sos=response.getOutputStream();
- }catch(IOExceptione){
- //TODOAuto-generatedcatchblock
- e.printStackTrace();
- }
- StringBuffersbu=newStringBuffer();
- Iteratorita=(Iterator)list.iterator();
- while(ita.hasNext()){
- supplyCategorysupplycategory=(supplyCategory)ita.next();
- sbu.append("<country>");
- sbu.append("<categoryName>"+supplycategory.getCategoryName()+"</categoryName>");
- sbu.append("<parentId>"+supplycategory.getParentId()+"</parentId>");
- sbu.append("</country>");
- }
- try{
- sos.print("<?xmlversion='1.0'encoding='UTF-8'?><records>"+sbu.toString()+"</records>");
- }catch(IOExceptione){
- //TODOAuto-generatedcatchblock
- e.printStackTrace();
- }
- }
- }
- packageisc.java.Web;
- importisc.java.Module.supplyItem;
- importisc.java.Service.supplyItem_Service;
- importjava.io.IOException;
- importjava.util.Iterator;
- importjava.util.List;
- importjavax.servlet.ServletOutputStream;
- importjavax.servlet.http.HttpServletRequest;
- importjavax.servlet.http.HttpServletResponse;
- importorg.springframework.beans.factory.annotation.Autowired;
- importorg.springframework.stereotype.Controller;
- importorg.springframework.web.bind.annotation.RequestMapping;
- @Controller
- publicclasssupplyItem_Controller{
- privatesupplyItem_ServicesupplyItem_service;
- @Autowired
- publicvoidsetSupplyItem_service(supplyItem_ServicesupplyItem_service){
- this.supplyItem_service=supplyItem_service;
- }
- /*
- *从数据库中提取数据以xml格式存储
- *
- **/
- @SuppressWarnings("unchecked")
- @RequestMapping(value="demoApp/findAll.action")
- publicvoidfindAll(HttpServletResponseresponse,HttpServletRequestrequest){
- Stringcategory=request.getParameter("category");//接受前台传过来的参数
- List<supplyItem>list=this.supplyItem_service.findAll(category);
- ServletOutputStreamsos=null;
- try{
- sos=response.getOutputStream();
- }catch(IOExceptione){
- e.printStackTrace();
- }
- StringBuffersbu=newStringBuffer();
- Iteratorita=(Iterator)list.iterator();
- while(ita.hasNext()){
- supplyItemsupplyitem=(supplyItem)ita.next();
- sbu.append("<country>");
- sbu.append("<itemID>"+supplyitem.getItemID()+"</itemID>");
- sbu.append("<itemName>"+supplyitem.getItemName()+"</itemName>");
- sbu.append("<unitCost>"+supplyitem.getUnitCost()+"</unitCost>");
- sbu.append("<SKU>"+supplyitem.getSKU()+"</SKU>");
- sbu.append("<description>"+supplyitem.getDescription()+"</description>");
- sbu.append("<category>"+supplyitem.getCategory()+"</category>");
- sbu.append("<inStock>"+supplyitem.getInStock()+"</inStock>");
- sbu.append("<nextShipment>"+supplyitem.getNextShipment()+"</nextShipment>");
- sbu.append("</country>");
- }
- try{
- sos.print("<?xmlversion='1.0'encoding='UTF-8'?><records>"+sbu.toString()+"</records>");
- }catch(IOExceptione){
- e.printStackTrace();
- }
- }
- @RequestMapping(value="demoApp/deleteInfo.action")
- publicvoiddeleteInfo(HttpServletRequestrequest){
- intitemID=Integer.parseInt(request.getParameter("itemID"));
- System.out.println("test======================"+itemID);
- this.supplyItem_service.deleteInfo(itemID);
- }
- @RequestMapping(value="demoApp/updateInfo.action")
- publicvoidupdateInfo(HttpServletRequestrequest){
- intitemID=Integer.parseInt(request.getParameter("itemID"));
- supplyItemsupp=this.supplyItem_service.findInfoByID(itemID);
- supp.setSKU(request.getParameter("SKU"));
- supp.setCategory(request.getParameter("category"));
- supp.setDescription(request.getParameter("description"));
- supp.setInStock(request.getParameter("inStock"));
- supp.setItemName(request.getParameter("itemName"));
- supp.setNextShipment(request.getParameter("nextShipment"));
- Strings=request.getParameter("unitCost");
- supp.setUnitCost(Double.parseDouble(s));
- this.supplyItem_service.updateInfo(supp);
- }
- @RequestMapping(value="demoApp/insertInfo.action")
- publicvoidinsertInfo(HttpServletRequestrequest){
- supplyItemsupp=newsupplyItem();
- supp.setCategory(request.getParameter("category"));
- supp.setSKU(request.getParameter("SKU"));
- supp.setDescription(request.getParameter("description"));
- supp.setInStock(request.getParameter("inStock"));
- supp.setItemName(request.getParameter("itemName"));
- supp.setNextShipment(request.getParameter("nextShipment"));
- supp.setUnitCost(Double.parseDouble(request.getParameter("unitCost")));
- this.supplyItem_service.insertInfo(supp);
- }
- }
- Xml
- App-config.xml
- <?xmlversion="1.0"encoding="UTF-8"?>
- <beansxmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
- <!--Scanstheclasspathofthisapplicationfor@Componentstodeployasbeans-->
- <!--規約所有進行掃描的類,以完成Bean創建和自動依賴注入功能-->
- <context:component-scanbase-package="isc.java.*"/>
- <!--<context:annotation-config/>-->
- <!--Configuresthe@Controllerprogrammingmodel-->
- <mvc:annotation-driven/>
- <!--misc-->
- <beanid="viewResolver"class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <propertyname="viewClass"value="org.springframework.web.servlet.view.JstlView"/>
- <propertyname="suffix"value=".action"/>
- </bean>
- <!--ConfiguresHibernate-DatabaseConfig-->
- <importresource="db-config.xml"/>
- </beans>
- Db-config.xml
- <?xmlversion="1.0"encoding="UTF-8"?>
- <beansxmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd
- http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
- <beanid="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <propertyname="driverClassName"><value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value></property>
- <propertyname="url"><value>jdbc:sqlserver://10.1.100.215:1433;DatabaseName=email</value></property>
- <propertyname="username"><value>dev</value></property>
- <propertyname="password"><value>12345678aA</value></property>
- </bean>
- <beanid="sessionFactory"class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
- <propertyname="dataSource"><reflocal="dataSource"/></property>
- <propertyname="packagesToScan"value="isc.java.*"/>
- <propertyname="hibernateProperties">
- <props>
- <propkey="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
- <propkey="hibernate.show_sql">true</prop>
- <!--<propkey="hibernate.hbm2ddl.auto">update</prop>-->
- <propkey="hibernate.format_sql">true</prop>
- </props>
- </property>
- </bean>
- <!--TransactionmanagerforasingleHibernateSessionFactory(alternativetoJTA)-->
- <tx:annotation-driven/>
- <beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <propertyname="sessionFactory"><reflocal="sessionFactory"/></property>
- <qualifiervalue="demoApp"/><!--限定词-->
- </bean>
- </beans>
相关推荐
7. **Smartclient+demo+实例**:提供的示例和演示代码帮助开发者了解SmartClient的实际应用场景,学习如何创建和使用各种组件和功能。 8. **hsql++(the Visual Builder DataSource)**:HSQL是一个轻量级的关系型...
在IT领域,智能客户端应用程序(Smart Client Application)是一种利用现代技术构建的桌面应用,它可以提供离线功能、自适应网络连接、丰富的用户界面以及高级的更新机制。在本系列课程的第十部分,我们重点关注如何...
简单的通信小程序,网上几乎找不到200smart通信案例,这里其实还是通过其他的方式对200smart进行通信,不过好歹能通信上,能做一些简单的应用,太复杂的估计就不行了,不过复杂的操作也用不到200smart了。
license-client 1.0.0-SNAPSHOT 2、载入License。如若License已过期,则会触发异常。 public class LicenseTest { public static void main(String[] args) throws Exception { File file=new File(...
级联H桥SVG无功补偿系统在不平衡电网中的三层控制策略:电压电流双闭环PI控制、相间与相内电压均衡管理,级联H桥SVG无功补偿系统在不平衡电网中的三层控制策略:电压电流双闭环PI控制、相间与相内电压均衡管理,不平衡电网下的svg无功补偿,级联H桥svg无功补偿statcom,采用三层控制策略。 (1)第一层采用电压电流双闭环pi控制,电压电流正负序分离,电压外环通过产生基波正序有功电流三相所有H桥模块直流侧平均电压恒定,电流内环采用前馈解耦控制; (2)第二层相间电压均衡控制,注入零序电压,控制通过注入零序电压维持相间电压平衡; (3)第三层相内电压均衡控制,使其所有子模块吸收的有功功率与其损耗补,从而保证所有H桥子模块直流侧电压值等于给定值。 有参考资料。 639,核心关键词: 1. 不平衡电网下的SVG无功补偿 2. 级联H桥SVG无功补偿STATCOM 3. 三层控制策略 4. 电压电流双闭环PI控制 5. 电压电流正负序分离 6. 直流侧平均电压恒定 7. 前馈解耦控制 8. 相间电压均衡控制 9. 零序电压注入 10. 相内电压均衡控制 以上十个关键词用分号分隔的格式为:不
GTX 1080 PCB图纸,内含图纸查看软件
内容概要:本文档详细介绍了利用 DeepSeek 进行文本润色和问答交互时提高效果的方法和技巧,涵盖了从明确需求、提供适当上下文到尝试开放式问题以及多轮对话的十个要点。每一部分内容都提供了具体的示范案例,如指定回答格式、分步骤提问等具体实例,旨在指导用户更好地理解和运用 DeepSeek 提升工作效率和交流质量。同时文中还强调了根据不同应用场景调整提示词语气和风格的重要性和方法。 适用人群:适用于希望通过优化提问技巧以获得高质量反馈的企业员工、科研人员以及一般公众。 使用场景及目标:本文针对所有期望提高 DeepSeek 使用效率的人群,帮助他们在日常工作中快速获取精准的答案或信息,特别是在撰写报告、研究材料准备和技术咨询等方面。此外还鼓励用户通过不断尝试不同形式的问题表述来进行有效沟通。 其他说明:该文档不仅关注实际操作指引,同样重视用户思维模式转变——由简单索取答案向引导 AI 辅助创造性解决问题的方向发展。
基于FPGA与W5500实现的TCP网络通信测试平台开发——Zynq扩展口Verilog编程实践,基于FPGA与W5500芯片的TCP网络通信测试及多路Socket实现基于zynq开发平台和Vivado 2019软件的扩展开发,基于FPGA和W5500的TCP网络通信 测试平台 zynq扩展口开发 软件平台 vivado2019.2,纯Verilog可移植 测试环境 压力测试 cmd命令下ping电脑ip,同时采用上位机进行10ms发包回环测试,不丢包(内部数据回环,需要时间处理) 目前实现单socket功能,多路可支持 ,基于FPGA; W5500; TCP网络通信; Zynq扩展口开发; 纯Verilog可移植; 测试平台; 压力测试; 10ms发包回环测试; 单socket功能; 多路支持。,基于FPGA与W5500的Zynq扩展口TCP通信测试:可移植Verilog实现的高效网络通信
Labview液压比例阀伺服阀试验台多功能程序:PLC通讯、液压动画模拟、手动控制与调试、传感器标定、报警及记录、自动实验、数据处理与查询存储,报表生成与打印一体化解决方案。,Labview液压比例阀伺服阀试验台多功能程序:PLC通讯、液压动画模拟、手动控制与调试、传感器标定、报警管理及实验自动化,labview液压比例阀伺服阀试验台程序:功能包括,同PLC通讯程序,液压动画,手动控制及调试,传感器标定,报警设置及报警记录,自动实验,数据处理曲线处理,数据库存储及查询,报表自动生成及打印,扫码枪扫码及信号录入等~ ,核心关键词:PLC通讯; 液压动画; 手动控制及调试; 传感器标定; 报警设置及记录; 自动实验; 数据处理及曲线处理; 数据库存储及查询; 报表生成及打印; 扫码枪扫码。,Labview驱动的智能液压阀测试系统:多功能控制与数据处理
华为、腾讯、万科员工职业发展体系建设与实践.pptx
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
电网不对称故障下VSG峰值电流限制的柔性控制策略:实现电流平衡与功率容量的优化利用,电网不对称故障下VSG峰值电流限制的柔性控制策略:兼顾平衡电流与功率控制切换的动态管理,电网不对称故障下VSG峰值电流限制的柔性不平衡控制(文章完全复现)。 提出一种在不平衡运行条件下具有峰值电流限制的可变不平衡电流控制方法,可灵活地满足不同操作需求,包括电流平衡、有功或无功恒定运行(即电流控制、有功控制或无功控制之间的相互切),注入电流保持在安全值内,以更好的利用VSG功率容量。 关键词:VSG、平衡电流控制、有功功率控制、无功功率控制。 ,VSG; 峰值电流限制; 柔性不平衡控制; 电流平衡控制; 有功功率控制; 无功功率控制。,VSG柔性控制:在电网不对称故障下的峰值电流限制与平衡管理
1、文件内容:libpinyin-tools-0.9.93-4.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/libpinyin-tools-0.9.93-4.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、更多资源/技术支持:公众号禅静编程坊
数据集是一个以经典动漫《龙珠》为主题的多维度数据集,广泛应用于数据分析、机器学习和图像识别等领域。该数据集由多个来源整合而成,涵盖了角色信息、战斗力、剧情片段、台词以及角色图像等多个方面。数据集的核心内容包括: 角色信息:包含《龙珠》系列中的主要角色及其属性,如名称、种族、所属系列(如《龙珠》《龙珠Z》《龙珠超》等)、战斗力等级等。 图像数据:提供角色的图像资源,可用于图像分类和角色识别任务。这些图像来自动画剧集、漫画和相关衍生作品。 剧情与台词:部分数据集还包含角色在不同故事中的台词和剧情片段,可用于文本分析和自然语言处理任务。 战斗数据:记录角色在不同剧情中的战斗力变化和战斗历史,为研究角色成长和剧情发展提供支持。 数据集特点 多样性:数据集整合了角色、图像、文本等多种类型的数据,适用于多种研究场景。 深度:不仅包含角色的基本信息,还涵盖了角色的成长历程、技能描述和与其他角色的互动关系。 实用性:支持多种编程语言(如Python、R)的数据处理和分析,提供了详细的文档和示例代码。
基于protues仿真的多功公交站播报系统设计(仿真图、源代码) 该设计为基于protues仿真的多功公交站播报系统,实现温度显示、时间显示、和系统公交站播报功能; 具体功能如下: 1、系统使用51单片机为核心设计; 2、时钟芯片进行时间和日期显示; 3、温度传感器进行温度读取; 4、LCD12864液晶屏进行相关显示; 5、按键设置调节时间; 6、按键设置报站; 7、仿真图、源代码; 操作说明: 1、下行控制报站:首先按下(下行设置按键),(下行指示灯)亮,然后按下(手动播报)按键控制播报下一站; 2、上行控制报站:首先按上(上行设置按键),(上行指示灯)亮,然后按下(手动播报)按键控制播报下一站; 3、按下关闭播报按键,则关闭播报功能和清除显示
采用Java后台技术和MySQL数据库,在前台界面为提升用户体验,使用Jquery、Ajax、CSS等技术进行布局。 系统包括两类用户:学生、管理员。 学生用户 学生用户只要实现了前台信息的查看,打开首页,查看网站介绍、琴房信息、在线留言、轮播图信息公告等,通过点击首页的菜单跳转到对应的功能页面菜单,包括网站首页、琴房信息、注册登录、个人中心、后台登录。 学生用户通过账户账号登录,登录后具有所有的操作权限,如果没有登录,不能在线预约。学生用户退出系统将注销个人的登录信息。 管理员通过后台的登录页面,选择管理员权限后进行登录,管理员的权限包括轮播公告管理、老师学生信息管理和信息审核管理,管理员管理后点击退出,注销登录信息。 管理员用户具有在线交流的管理,琴房信息管理、琴房预约管理。 在线交流是对前台用户留言内容进行管理,删除留言信息,查看留言信息。
MATLAB可以用于开发人脸识别考勤系统。下面是一个简单的示例流程: 1. 数据采集:首先收集员工的人脸图像作为训练数据集。可以要求员工提供多张照片以获得更好的训练效果。 2. 图像预处理:使用MATLAB的图像处理工具对采集到的人脸图像进行预处理,例如灰度化、裁剪、缩放等操作。 3. 特征提取:利用MATLAB的人脸识别工具包,如Face Recognition Toolbox,对处理后的图像提取人脸特征,常用的方法包括主成分分析(PCA)和线性判别分析(LDA)等。 4. 训练模型:使用已提取的人脸特征数据集训练人脸识别模型,可以选择支持向量机(SVM)、卷积神经网络(CNN)等算法。 5. 考勤系统:在员工打卡时,将摄像头捕获的人脸图像输入到训练好的模型中进行识别,匹配员工信息并记录考勤数据。 6. 结果反馈:根据识别结果,可以自动生成考勤报表或者实时显示员工打卡情况。 以上只是一个简单的步骤,实际开发过程中需根据具体需求和系统规模进行定制和优化。MATLAB提供了丰富的图像处理和机器学习工具,是开发人脸识别考勤系统的一个很好选择。
hjbvbnvhjhjg
HCIP、软考相关学习PPT提供下载
绿豆BOX UI8版:反编译版六个全新UI+最新后台直播管理源码 最新绿豆BOX反编译版六个UI全新绿豆盒子UI8版本 最新后台支持直播管理 作为UI6的升级版,UI8不仅修复了前一版本中存在的一些BUG,还提供了6套不同的UI界面供用户选择,该版本有以下特色功能: 在线管理TVBOX解析 在线自定义TVBOX 首页布局批量添加会员信息 并支持导出批量生成卡密 并支持导出直播列表管理功能