此文为转载
用实例见证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是一个轻量级的关系型...
《SmartClient DemoApp详解》 SmartClient是一款强大的JavaScript和HTML5客户端开发框架,它提供了丰富的UI组件和数据管理功能,广泛应用于企业级Web应用开发。本文将深入解析名为"smartclient demoApp"的示例应用...
"SmartClient"是一款强大的富客户端应用开发框架,主要用于构建高性能、交互性强的Web应用程序。它提供了丰富的用户界面组件,使得开发者能够快速地创建出复杂的业务逻辑和数据密集型的前端应用。SmartClient的核心...
在本实例中,我们将探讨如何利用Java SmartClient进行基础的开发工作,以及如何处理缺失的jar包问题。 首先,Java SmartClient的核心是其强大的GWT(Google Web Toolkit)兼容性,这使得开发者可以使用Java语言编写...
"SmartClient"是一种在IT行业中常见的术语,通常指的是具有高度智能化和自适应能力的客户端应用程序。这类客户端能够根据用户的行为、环境或者系统状态自动调整其功能和表现,提供更个性化的用户体验。在这个“智能...
本文将详细探讨如何将SmartClient与Spring框架结合,以实现一个测试tree和list组建的应用实例。 首先,我们需要理解SmartClient的核心特性。SmartClient包含一套丰富的JavaScript和Java UI组件库,这些组件可以提供...
**SpringMVC、Hibernate、DWR与SmartClient的整合应用** SpringMVC是Spring框架的一部分,主要用于构建Web应用程序的模型-视图-控制器(MVC)结构。它提供了灵活的控制器,支持多种视图技术,并允许开发者以声明式...
SmartClient是一种强大的JavaScript和Java应用程序框架,用于构建高性能、富客户端的Web应用。这个"smartclient视频教程"可能涵盖了从基础到高级的各种主题,帮助学习者深入理解和掌握这个技术。 SmartClient的核心...
Smart Client智能客户端就是这样一种一个可扩展的能集成不同应用的桌面应用程序:它可以无接触部署、即需即装、动态加载,XCopy即可运行而无须修改注册表,可以动态升级、自动更新,可以方便的经Web运行而不用担心...
**Smart Client架构与设计指南** 智能客户端(Smart Client)是一种软件开发模式,它结合了桌面应用的优势,如离线操作、高性能和丰富的用户界面,同时利用互联网连接来获取实时数据和更新。Smart Client架构旨在...
智能客户端(Smart Client)是一种软件开发模式,它旨在提供更高效、更个性化、更互动的用户体验,尤其是在企业级应用中。这种技术强调利用本地计算资源,如存储、内存和处理器性能,来提升应用程序的响应速度和功能...
在IT行业中,Smart Client是一种应用程序开发模式,它旨在提供比传统的 Thick Client(胖客户端)或 Thin Client(瘦客户端)更为智能、自适应和高效的用户体验。Smart Client应用通常结合了本地计算能力和网络通信...
SmartClient是一种强大的JavaScript和Java框架,用于构建高性能的富客户端Web应用。这个压缩包包含的是SmartClient的一个经典示例,提供了源代码供学习和参考。SmartClient的核心特性在于它的组件库、数据绑定机制...
`Class`是所有SmartClient组件的基类,提供了创建类实例、添加方法和属性的功能。通过继承和组合,开发者可以构建复杂的组件结构。例如,`Timer`组件就是基于`Class`构建的,它实现了定时任务的执行,可以用于定时...
smart client安卓系统的安装包
SmartClient JavaScript框架是一款强大的富客户端应用开发工具,它提供了丰富的组件库、数据绑定机制和高度可定制的界面,使得开发者可以构建高性能、交互性强的Web应用程序。源码分析是理解框架内部工作原理的关键...
标题中的“西门子3个SMART plc+触摸屏控制7台松下A5伺服”描述了一个工业自动化系统,其中三个西门子SMART系列的可编程逻辑控制器(PLC)与一个触摸屏配合,用于控制七台松下A5系列的伺服电机。这个系统涉及到的主要...
### SmartClient:构建高效Web应用的关键技术 #### 引言 SmartClient是由Isomorphic Software开发的一款先进的企业级Web应用程序框架,旨在提供卓越的用户界面体验和高性能的数据处理能力。自2001年首次发布以来,...
Smart Client技术是一种旨在结合传统胖客户端(C/S架构)的强大功能和瘦客户端(B/S架构)的便捷部署与管理优势的客户端技术。它通过优化资源利用,为用户提供更丰富的交互体验,同时降低对系统资源的需求。 Smart ...