List<User> list =this.getHibernateTem

图片说明
不明原因 为什么出问题了问题是Type mismatch: cannot convert from List to List

3个回答

你在list那行打断点,然后看查到的是什么,就明白了,或者贴图上来

niepeng2015
niepeng2015 你看不到我的图片吗?
接近 4 年之前 回复

这个不会
List Reponsibilities for an user
Accessing columns in the User Information List
How to add a user to the sudoers list

你不发全代码,怎么帮你 晕

niepeng2015
niepeng2015 我上传了图片唉
接近 4 年之前 回复
niepeng2015
niepeng2015 这代码还不全吗? 难道还关乎其他类?
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SSH整合问题实现DAO接口出现的问题
package com.integration.dao; import java.util.List; import com.integration.entity.User; import org.hibernate.Query; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class UserDAOImpl extends HibernateDaoSupport implements UserDAO{ public void save(User user) { this.getHibernateTemplate().save(user); } public User getUser(String name) { String hsql="from User u where u.name='"+name+"'"; User result=(User)((Query) this.getHibernateTemplate().find(hsql)).uniqueResult(); return result; } public void delete(int id) { this.getHibernateTemplate().delete(findById(id)); } public void update(User user){ this.getHibernateTemplate().update(user); } public User findById(int id) { User user = (User) this.getHibernateTemplate().get(User.class, id); return user; } @SuppressWarnings("unchecked") public List<User> findAll() { // TODO Auto-generated method stub String queryString="from User"; List<User> list=**this.getHibernateTemplate().find(queryString);** return list; } } 提示的问题是Type mismatch: cannot convert from List<Object> to List<User>
this.getHibernateTemplate().update(user);不执行修改操作
this.getHibernateTemplate().update(user);执行了新增操作却没有执行修改操作 重点就是一行代码“this.getHibernateTemplate().update(user);” 为什么执行不了修改操作而执行的是新增操作 而且我以前同样的写法却可以执行修改操作 ``` //Dao层的实现类 @Override public boolean update(User user) { // TODO Auto-generated method stub this.getHibernateTemplate().update(user); return true; } //Service层实现类 @Override public boolean update(User user) { // TODO Auto-generated method stub return this.dao.update(user); } //Action层 public String update(){ boolean a = this.service.update(user); if (a) { return SUCCESS; } else { return ERROR; } } //User实体类 package com.bochy.vo; /** * User entity. @author MyEclipse Persistence Tools */ public class User implements java.io.Serializable { // Fields private Integer UId; private String UName; private Integer UAge; // Constructors /** default constructor */ public User() { } /** minimal constructor */ public User(Integer UId) { this.UId = UId; } /** full constructor */ public User(Integer UId, String UName, Integer UAge) { this.UId = UId; this.UName = UName; this.UAge = UAge; } // Property accessors public Integer getUId() { return this.UId; } public void setUId(Integer UId) { this.UId = UId; } public String getUName() { return this.UName; } public void setUName(String UName) { this.UName = UName; } public Integer getUAge() { return this.UAge; } public void setUAge(Integer UAge) { this.UAge = UAge; } } //实体类映射文件 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Mapping file autogenerated by MyEclipse Persistence Tools --> <hibernate-mapping> <class name="com.bochy.vo.User" table="user"> <id name="UId" type="java.lang.Integer"> <column name="u_id" /> <generator class="increment" /> </id> <property name="UName" type="java.lang.String"> <column name="u_name" /> </property> <property name="UAge" type="java.lang.Integer"> <column name="u_age" /> </property> </class> </hibernate-mapping> //Spring总配置文件 <!-- 导入本地的jdbc.properties --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:spring/jdbc.properties</value> </property> </bean> <!-- 导入dataSource --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}"></property> <property name="url" value="${jdbc.url}"></property> <property name="username" value="${jdbc.username}"></property> <property name="password" value="${jdbc.password}"></property> </bean> <!-- 导入sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- 导入dataSource --> <property name="dataSource"> <ref bean="dataSource"></ref> </property> <!-- 配置文件 --> <property name="hibernateProperties"> <props> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> </props> </property> <!-- 映射文件 --> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/bochy/vo</value> </list> </property> </bean> <import resource="applicationContext-user.xml"/> <import resource="applicationContext-transaction.xml"/> //Spring-user配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <bean id="userDao" class="com.bochy.dao.impl.UserDaoImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="userService" class="com.bochy.service.impl.UserServiceImpl"> <property name="dao"> <ref bean="userDao"/> </property> </bean> <bean id="userAction" class="com.bochy.action.UserAction"> <property name="service"> <ref bean="userService"/> </property> </bean> </beans> //spring事务管理配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <!-- 事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 生命策略 --> <tx:advice id="tx" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="*"/> </tx:attributes> </tx:advice> <!-- AOP配置 --> <aop:config> <aop:pointcut expression="execution(* com.bochy.service.impl.*.*(..))" id="p"/> <aop:advisor advice-ref="tx" pointcut-ref="p"/> </aop:config> </beans> //Struts配置文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <constant name="struts.devMode" value="true"></constant> <package name="user" extends="struts-default" namespace="/user"> <action name="find" class="userAction" method="find"> <result name="success">/User_add_success.jsp</result> </action> <action name="add" class="userAction" method="add"> <result name="success" type="redirectAction">find</result> <result name="error">/index.jsp</result> </action> <action name="findbyid" class="userAction" method="findbyid"> <result name="success">/User_update.jsp</result> </action> <action name="update" class="userAction" method="update"> <result name="success" type="redirectAction">find</result> <result name="error">/index.jsp</result> </action> </package> </struts> ```
vue的vuescroll插件苹果手机滑动不了,安卓手机没有问题
大佬们救助啊!!! ```<template> <div style="margin-top:-80px;"> <div class="page__hd"> <div class="weui-form-preview__ft"> <label class="weui-form-preview__btn weui-form-preview__btn_default"> <span @click="toIndex" style="color:rgb(0, 0, 0);">&lt;返回</span> </label> <label type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" href="javascript:" style="color:rgb(0, 0, 0);" >{{this.zqName}}合同</label> <label type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" style="color:rgb(0, 0, 0);" @click="select" > 筛选 <img src="../assets/000.png" height="20px" width="20px" /> </label> </div> </div> <div class="pr-wrap_tra" style=" overflow-y: scroll;touch-action: pan-y;-webkit-overflow-scrolling: touch;"> <div class="wrap-part_tra first_tra" > <vuescroll ref="vs" :ops="ops" @refresh-start="handleRS" @load-before-deactivate="handleLBD" @refresh-before-deactivate="handleRBD" @load-start="handleLoadStart" > <div v-for="item in ContractList" :key="item.dictid"> <div class="contractList_css_tra"> <div class="list_css_tra" @click="jumppage(item.dictid)"> <span style="float:left;">{{item.farmername}}</span> <span style="float:right;" v-if=" item.isrecord=== 0">糖厂未上报</span> <span style="float:right;" v-if=" item.isrecord=== 1">乡政府退回</span> <span style="float:right;" v-if=" item.isrecord=== 2">县政府退回</span> <span style="float:right;" v-if=" item.isrecord=== 5">糖厂已上报</span> <span style="float:right;" v-if=" item.isrecord=== 6">乡政府已上报</span> <span style="float:right" v-if=" item.isrecord=== 7">县政府已备案</span> <br /> <span style="color:#4169E1;float:left;margin-top: -5px;">({{item.ocnum}})</span> <!-- <p style="float:left; font-size:15px; color:#C0C0C0; margin-top: 5px" >&nbsp;&nbsp;{{item.signdate}}</p> --> <br /> <hr style="width: 100%;" /> <div class="tr_css_tra"> <table class="table_css_tra"> <tr class="title_tra"> <td>种植面积</td> <td>种植产量</td> <td>风险值</td> </tr> <tr class="content_tra"> <td>{{item.area?item.area.toFixed(2):0}} <span style="font-weight:bold;font-size: 13px;">亩</span> </td> <td>{{item.yeild?item.yeild.toFixed(2):0}} <span style="font-weight:bold;font-size: 13px;">吨</span></td> <td v-if=" item.isrecord == 0"> <span style="font-weight:bold;font-size: 13px;">-</span></td> <td v-if=" item.isrecord > 0 && item.matchstate ==0"> <span style="font-weight:bold;font-size: 13px;">计算中</span></td> <td v-if=" item.isrecord > 0 && item.matchstate ==1"> {{item.riskevaluation}} <span style="font-weight:bold;font-size: 13px;">%</span></td> </tr> </table> </div> <hr style="width: 100%;" /> <span style="float:left; margin-top: 10px; ">{{item.departname?item.departname:''}}</span> <span style="float:right; margin-top: 10px;">详情></span> </div> </div> </div> <div id="nodata" style="display:none">{{this.context}}</div> </vuescroll> </div> </div> </div> </template> <script> import vuescroll from "vuescroll"; import farmers from "@/api/farmers"; import indexApi from "@/api/index"; import Vue from "vue"; import axios from "axios"; export default { name: "myvuescroll", props: { // 语言 lang: { default: "zh" // en }, // 距离底部触发自动加载的距离 autoLoadDistance: { default: 10 }, // 是否开启下拉刷新 isRefresh: { default: true }, // 是否开启上拉加载 isPushLoad: { default: true }, // 数据是否全部加载完成 true为全部加载完成 noData: { default: false }, // 下拉刷新开始 refreshStart: { default: () => {} }, // 下拉刷新完成之后 refreshDeactivate: { default: () => {} }, // 上拉开始 loadStart: { default: () => {} }, // 上拉完成之后 loadDeactivate: { default: () => {} } }, components: { vuescroll }, data() { const config = {}; const ops = { vuescroll: { mode: "slide", pullRefresh: { enable: this.isRefresh }, pushLoad: { enable: this.isPushLoad, auto: true, //是否自动触发加载 autoLoadDistance: this.autoLoadDistance } } }; if (this.lang == "zh") { ops.vuescroll.pullRefresh.tips = { deactive: "下拉刷新", active: "释放刷新", start: "刷新中...", beforeDeactive: "刷新成功!" }; ops.vuescroll.pushLoad.tips = { deactive: "上拉加载", active: "释放加载", start: "加载中...", beforeDeactive: "加载成功!" }; } return { ops, config, pageNo: 1, isfirstload: false, end: 0, is: true, ContractList: [], zqName: "", minrisk: 0, maxrisk: 0, farmersName: "", contractCode: "", record: "", data: {}, zqCode: "", departCode: "", xzCode:"", user:{}, sx:true, xl:true, presser:'', context:'', //, maxarea:0, // minarea:0, // isrecord:0, // ocnum:0, // farmername:'' }; }, // created: function() { // this.myInstalHomeFun(); // }, created:function(){ this.user = this.$route.params.user; this.zqCode = this.$route.params.zqCode; this.departCode = this.$route.params.departCode; this.xzCode=this.$route.params.xzCode; this.zqName = this.$route.params.zqName; this.presser = this.$route.params.presser; }, mounted: function() { this.minrisk = this.$route.params.minrisk; this.maxrisk = this.$route.params.maxrisk; this.farmersName = this.$route.params.farmersName; this.contractCode = this.$route.params.contractCode; this.record = this.$route.params.record; this.FarmersContractList(); //需要触发的函数 // alert(this.minrisk) // alert(this.maxrisk) // alert(this.farmersName) // alert(this.contractCode) // alert(this.record) }, methods: { // FarmersContractList() { // let _this = this; // axios({ // url: // "/api/cloudec/fo/order/OrderContractController/GetOrderContractPage", // method: "post", // data: { // pageNo: 1, // pageSize: 10 // this.data=this.$route.query; // // this.maxarea=this.$route.query.maxarea; // // this.minarea=this.$route.query.minarea; // // this.isrecord=this.$route.query.isrecord; // // this.ocnum=this.$route.query.ocnum; // // this.farmername=this.$route.query.farmername; // }, // 刷新开始 // vsInstance vm===this // refreshDom === 刷新dom handleRS(vsInstance, refreshDom, done) { if (this.refreshStart) { this.refreshStart(done); } else { //this.setDone1(done); done(); } }, // 刷新完之后 handleRBD(vm, loadDom, done) { if (this.refreshDeactivate) { this.refreshDeactivate(done); } else { setTimeout(() => { this.setDone1(done); }, 600); } }, // 上拉开始 handleLoadStart(vm, dom, done) { if (this.loadStart) { this.loadStart(done); } else { if (this.isfirstload) { //this.setDone(done); done(); } else { done(); this.isfirstload = true; } } }, // 上拉完成后 handleLBD(vm, loadDom, done) { if (!this.$parent.noData) { if (this.loadDeactivate) { this.loadDeactivate(done); } else { setTimeout(() => { this.setDone(done); //done(); }, 600); } } else { setTimeout(() => { this.setDone(done); //done(); }, 600); } }, // 手动触发 外部通过ref触发 // type load 为加载 refresh 为刷新 trigger(type = "load") { this.$refs["vs"].triggerRefreshOrLoad(type); }, setDone(done) { if(this.sx){ this.pageNo++; this.FarmersContractList(); } done(); }, setDone1(done) { if(this.xl){ this.xl=false; this.ContractList = []; this.is=true; this.pageNo = 1; this.FarmersContractList(); } done(); }, FarmersContractList(done) { let _this = this; if (_this.is) { indexApi.FarmersContractList(this.pageNo,this.maxrisk,this.minrisk,this.record,this.contractCode,this.farmersName,this.departCode, this.zqCode,this.presser,this.xzCode,this.zj) .then(function(response) { // response.data中获取ResponseData实体 // alert(response); if(response.data.pageSize==0){ _this.context="暂无数据"; } for (var i = 0; i < response.data.page.dataList.length; i++) { _this.sx=false; _this.xl=false; _this.ContractList.push(response.data.page.dataList[i]); } _this.sx=true; _this.xl=true; if (response.data.page.totalPage == _this.pageNo) { _this.is = false; _this.context="暂无更多数据"; } //_this.ContractList = response.data.page.dataList; }) .catch(function(error) { // 发生错误 }); } else { //document.getElementById("nodata").style.display = "block"; } }, select() { this.$router.replace({ name: "select", params: { user: this.user, departCode:this.departCode, zqCode:this.zqCode, xzCode:this.xzCode, zqName:this.zqName, presser:this.presser } }); }, jumppage(val) { this.$router.replace({name: "contractInfo", params: { user: this.user,dictid: val, departCode:this.departCode, zqCode:this.zqCode, xzCode:this.xzCode, zqName:this.zqName, presser:this.presser}}); }, toIndex(){ this.$router.replace({name: "index"+this.user.wxUserInfo.userType, params: { user: this.user}}); } } }; </script> <style> .pr-wrap_tra { display: flex; height: calc(93vh); justify-content: center; width: 100%; } .pr-wrap_tra .wrap-part_tra { height: 100%; width: 100%; } .pr-wrap_tra .wrap-part_tra .first_tra { width: 100%; width: 100%; } .contractList_css_tra { position: relative; margin: 0 auto; width: 90%; height: 170px; background-color: #ffffff; border-radius: 5px; padding: 10px 10px 10px 10px; box-shadow: 5px 5px 10px 2px#DCDCDC; margin-bottom: 20px; } .tr_css_tra { margin: 10px 10px 10px 10px; /* border: 1px solid red; */ } /* .table_tra { width: 100%; text-align: center; margin-top: 50px; position: relative; margin: 0 auto; } */ .content_tra { color: #045ce4; } .table_css_tra{ width: 100%; text-align: center; margin-top: 50px; position: relative; margin: 0 auto; } </style> ```
react-router如何像vue-router通过this.$router.push的方式编程实现路由跳转
最近在研究react,遇到一个编程路由跳转问题,其实我就是想实现,如果像vue-router的方式通过this.$router.push({name: '', ''});类似的方式实现跳转到不同的组件,网上找了好多方法,都不行,不知道错在哪里,求大神指点一下。 我的版本: ![图片说明](https://img-ask.csdn.net/upload/201901/18/1547780563_148060.png) ![图片说明](https://img-ask.csdn.net/upload/201901/18/1547780665_882261.png) ``` import React, { Component } from 'react'; // import logo from './logo.svg'; import './App.css'; import './style/common/base.css'; import './style/common/reset.css'; import Index from './pages/index/index.jsx'; import List from './pages/list/List.jsx'; import Detail from './pages/detail/Detail.jsx'; import Form from './pages/form/form.jsx'; import { Route, HashRouter, Switch, withRouter } from 'react-router-dom'; class App extends Component { constructor (props) { super(props); this.state = { msg: { name: 'zhangan', age: '212', arr: [1, 2, 3, '21'], obj: { hight: '160cm', width: '89kg' } } } // this.routerUrl = this.routerUrl.bind(this); } childFun (state, val) { console.log('子组件往父组件传递的值!'); console.log(state); console.log(val); } // 路由跳转,编程导航 routerUrl (url, params) { this.props.history.push({ pathname:"/index", query:{ name:"inbox", myas:"哈哈" } }); } render() { return ( <div className="App"> <div className="router"> <button onClick={this.routerUrl.bind(this)}>index</button> <button onClick={this.routerUrl.bind(this)}>detail</button> <button onClick={this.routerUrl.bind(this)}>list</button> <button onClick={this.routerUrl.bind(this)}>form</button> </div> <div className="content"> <HashRouter> <Switch> <Route exact path="/" component={Index}/> <Route exact path="/list" component={List}/> <Route exact path="/detail" component={Detail}/> <Route exact path="/form" component={Form}/> </Switch> </HashRouter> {/* <Index /> <Detail /> <List /> <Form msg={this.state.msg} clickFun={this.childFun.bind(this)}/> */} </div> </div> ); } componentWillMount () { console.log(this); } } export default App; ```
关于JSP中链接跳转的问题
我用javascript写了一个图片动态转换的效果,然后点击图片会跳入相应链接,如下javascript代码是我从其他项目代码移植过来的,结果我发现当点击进入链接页面的时候会从新打开一个新的页面,可是我想把初始的页面转换成新的页面,谁懂下列代码并且知道如何设置的,求指教! var isIE = (document.all) ? true : false; var $ = function (id) { return "string" == typeof id ? document.getElementById(id) : id; }; var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } var Extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } } var Bind = function(object, fun) { return function() { return fun.apply(object, arguments); } } var Each = function(list, fun){ for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); } }; //ie only var RevealTrans = Class.create(); RevealTrans.prototype = { initialize: function(container, options) { this._img = document.createElement("img"); this._a = document.createElement("a"); this._timer = null;//计时器 this.Index = 0;//显示索引 this._onIndex = -1;//当前索引 this.SetOptions(options); this.Auto = !!this.options.Auto; this.Pause = Math.abs(this.options.Pause); this.Duration = Math.abs(this.options.Duration); this.Transition = parseInt(this.options.Transition); this.List = this.options.List; this.onShow = this.options.onShow; //初始化显示区域 this._img.style.visibility = "hidden";//第一次变换时不显示红x图 this._img.style.width = this._img.style.height = "100%"; this._img.style.border = 0; this._img.onmouseover = Bind(this, this.Stop); this._img.onmouseout = Bind(this, this.Start); isIE && (this._img.style.filter = "revealTrans()"); this._a.target = "_blank"; $(container).appendChild(this._a).appendChild(this._img); }, //设置默认属性 SetOptions: function(options) { this.options = {//默认值 Auto: true,//是否自动切换 Pause: 1000,//停顿时间(微妙) Duration: 1,//变换持续时间(秒) Transition: 7,//变换效果(23为随机) List: [],//数据集合,如果这里不设置可以用Add方法添加 onShow: function(){}//变换时执行 }; Extend(this.options, options || {}); }, Start: function() { clearTimeout(this._timer); //如果没有数据就返回 if(!this.List.length) return; //修正Index if(this.Index < 0 || this.Index >= this.List.length){ this.Index = 0; } //如果当前索引不是显示索引就设置显示 if(this._onIndex != this.Index){ this._onIndex = this.Index; this.Show(this.List[this.Index]); } //如果要自动切换 if(this.Auto){ this._timer = setTimeout(Bind(this, function(){ this.Index++; this.Start(); }), this.Duration * 1000 + this.Pause); } }, //显示 Show: function(list) { if(isIE){ //设置变换参数 with(this._img.filters.revealTrans){ Transition = this.Transition; Duration = this.Duration; apply(); play(); } } this._img.style.visibility = ""; //设置图片属性 this._img.src = list.img; this._img.alt = list.text; //设置链接 !!list["url"] ? (this._a.href = list["url"]) : this._a.removeAttribute("href"); //附加函数 this.onShow(); }, //添加变换对象 Add: function(sIimg, sText, sUrl) { this.List.push({ img: sIimg, text: sText, url: sUrl }); }, //停止 Stop: function() { clearTimeout(this._timer); } };
security中使用mongotemplate.find()方法无法查询并报空指针
user实体类 ``` @Document public class User implements UserDetails{ private static final long serialVersionUID = 2L; String id; String username; String password; List<SimpleGrantedAuthority> grantedAuthorities; public User(String id, String username, String password, List<SimpleGrantedAuthority> grantedAuthorities) { this.id = id; this.username = username; this.password = password; this.grantedAuthorities = grantedAuthorities; } } ``` 其中,list 为继承UserDetails 必须要写的属性,会作为对象传入数据库中,不继承且没有此属性的时候并不会出错 被CustomUserDetailService调用的UserService,用于存取user对象 ``` @Service public class UserService { private static final String USER_COLLECTION = "user"; @Autowired MongoTemplate mongoTemplate; public void saveUser(User user){ mongoTemplate.insert(user); } public User findUserByName(String name){ User user = mongoTemplate.findOne(new Query(Criteria.where("username").is(name)), User.class, USER_COLLECTION); return user; } } ```
Spring @ModelAttribute 怎么绑定集合类
用spring框架@ModelAttribute绑定List<user>,我把user对象封装了一个对象,代码如下 public class QueryPagination { public User user; public List<User> items = new ArrayList<User>(); public User getUser() { return user; } public void setUser(User user) { this.user = user; } public List<User> getItems() { return items; } public void setItems(List<User> items) { this.items = items; } } 然后后台用 public String actionname(@ModelAttribute QueryPagination query,@ModelAttribute User user) 绑定,user里面有值,但是query为空对象 请问这个问题要怎么解决啊?
分页排序只排当页数据,有没有什么办法可以让把所有的数据都排上?下面放代码,求大佬指导参考
``` <mu-data-table selectable select-all :selects.sync="selects" :loading="tableLoading" :columns="columns" :sort.sync="sort" @sort-change="handleSortChange" :data="list" > <template slot-scope="scope"> <td>{{scope.row.title}}</td> <td class="is-right" style="padding-right: 20px;padding-left: 0px">{{scope.row.createdUserName}}</td> <td class="is-right" style="padding-right: 65px;padding-left: 0px">{{scope.row.averageScore|filteringDigital}}</td> <td class="is-right" style="padding-right: 0px;padding-left: 0px">{{scope.row.createdTime|dateFmt('YYYY-MM-DD HH:mm:ss')}}</td> <td class="is-right" style="padding-right: 150px;"> <mu-menu > <mu-button color="primary" small flat>操作<mu-icon right value="arrow_drop_down"></mu-icon></mu-button> <mu-list slot="content"> <mu-list-item button @click="details(scope.row.id)"> <mu-list-item-title>详情</mu-list-item-title> </mu-list-item> </mu-list> </mu-menu> </td> <td class="is-right">{{scope.row.iron}}</td> </template> </mu-data-table> <mu-flex justify-content="end" style="margin-top:24px;"> <mu-pagination :sort="sort" :total="current.totalSize" :current.sync="current.page" :page-size="current.pageSize" @change="changePage()"></mu-pagination> </mu-flex> </mu-paper> ``` script ``` handleSortChange ({name, order}) { if(name === 'score'){ this.list = this.list.sort((a, b) => order === 'asc' ? a[name] - b[name] : b[name] - a[name] ); }else{ this.list =this.list.sort((a,b) => { let aTimeString = a[name]; let bTimeString = b[name]; let aTime = Number(new Date(aTimeString).getTime()); let bTime = Number(new Date(bTimeString).getTime()); if(order === 'asc'){ return aTime-bTime }else { return bTime-aTime } }) } console.log(this.list) }, loadRethinkList(title){ this.tableLoading = true; testpage({ currentPage:this.current.page, pageSize:this.current.pageSize, start:0, data:{status:1,title:title} }).then(res =>{ if (res.code == 200) { this.list = res.data.list; this.current.totalSize = res.data.total; this.current.page = res.data.currentPage; console.log(res.data.list) } else { this.$toast.warning("量表列表获取失败: " + res.message) } this.tableLoading = false; }) }, changePage(){ this.loadRethinkList() }, details(id){ this.$router.push({path: '/rethink/info',name: "RethinkInfo", params:{ rethinkId: id }}); } }, ```
java.util.list和org.eclipse.swt.widgets.list无法同时使用
想合并两段代码,但是java.util.list和org.eclipse.swt.widgets.list两个包无法同时使用,怎么办?急,萌新求大神帮忙解决一下,谢谢!
C# 如何将一个类中全部字段添加到List中(字段为自定义类,引用类型,不是值类型)?
自定义了一个类,里面包含了很多字段(也是自定义的类),如何将类中的字段全部添加到list中 做这个功能主要是为了能够通过list来访问FileInfoInIni,调用FileInfoInIni的方法。 或者哪位大神有更好的办法能实现这个功能也行 ``` class SystemParamClass { public String ModelFileSavePathName = "D:/Data/SystemParam";//保存参数的文件夹名称 public String ModelSystemParamFileName = "/SystemParam.ini"; public List<FileInfoInIni> AllIniParam = new List<FileInfoInIni>(); public FileInfoInIni LeftDownCamGrapImageHeight; public FileInfoInIni LeftDownCamGrapImagePoseX; public FileInfoInIni LeftDownCamGrapImagePoseY; public FileInfoInIni RightDownCamGrapImageHeight public FileInfoInIni RightDownCamGrapImagePoseX; public FileInfoInIni RightDownCamGrapImagePoseY; } ``` 如何写一个方法,自动将 FileInfoInIni 全部添加到 AllIniParam 中 FileInfoInIni  为自定义的类,我试过了反射,只能设置值,不知道怎么转换类型,然后添加进去 ``` public static void AddTolist(object TempClass) { Type t = TempClass.GetType(); FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); foreach (FieldInfo field in fields) { if (field.FieldType == typeof(FileInfoInIni)) { Console.WriteLine("Field:" + field); Console.WriteLine("Field:" + field.Name ); } //Console.WriteLine("Field:" + field); } } ``` 不能强制转换类型 ![图片说明](https://img-ask.csdn.net/upload/201911/15/1573789359_269905.jpg) FileInfoInIni的定义 ``` public class FileInfoInIni { private string FilePathAndName; private string FileSection; private string FileAppName; public object Value; public string Key { get => FileAppName; } [DllImport("kernel32", CharSet = CharSet.Ansi, EntryPoint = "GetPrivateProfileStringA", ExactSpelling = true, SetLastError = true)] private static extern int GetPrivateProfileString([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpApplicationName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpKeyName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpDefault, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpReturnedString, int nSize, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpFileName); [DllImport("kernel32", CharSet = CharSet.Ansi, EntryPoint = "WritePrivateProfileStringA", ExactSpelling = true, SetLastError = true)] private static extern int WritePrivateProfileString([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpApplicationName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpKeyName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpString, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpFileName); public string GetINI(string Section, string AppName, string lpDefault, string FileName) { string text = Strings.LSet("", 256); FileInfoInIni.GetPrivateProfileString(ref Section, ref AppName, ref lpDefault, ref text, Strings.Len(text), ref FileName); return Strings.Left(text, checked(Strings.InStr(text, "\0", CompareMethod.Binary) - 1)); } public long WriteINI(string Section, string AppName, string lpDefault, string FileName) { return (long)FileInfoInIni.WritePrivateProfileString(ref Section, ref AppName, ref lpDefault, ref FileName); } public bool ReadValue() { bool result; try { this.Value = this.GetINI(this.FileSection, this.FileAppName, "", this.FilePathAndName); bool flag = Operators.ConditionalCompareObjectEqual(this.Value, "", false); if (flag) { result = false; return result; } } catch (Exception expr_41) { ProjectData.SetProjectError(expr_41); result = false; ProjectData.ClearProjectError(); return result; } result = true; return result; } public bool SaveValue() { bool result; try { string left = this.Value.ToString(); this.WriteINI(this.FileSection, this.FileAppName, Conversions.ToString(this.Value), this.FilePathAndName); string iNI = this.GetINI(this.FileSection, this.FileAppName, "", this.FilePathAndName); bool flag = Operators.CompareString(left, iNI, false) != 0; if (flag) { result = false; return result; } } catch (Exception expr_71) { ProjectData.SetProjectError(expr_71); result = false; ProjectData.ClearProjectError(); return result; } result = true; return result; } public FileInfoInIni(string TempFilePathAndName, string TempFileSection, string TempFileAppName) { this.Value = RuntimeHelpers.GetObjectValue(new object()); this.FilePathAndName = TempFilePathAndName; this.FileSection = TempFileSection; this.FileAppName = TempFileAppName; this.Value = null; } public void dispose() { this.FilePathAndName = ""; this.FileSection = ""; this.FileAppName = ""; this.Value = null; } } ```
在vue项目里使用axios,很平常的写法,报了个错,研究半天看不到,小白求教
这是script部分 ``` export default { name: "user_management", data() { return { user: [], proCateList:[], total:0, loading:true }; }, created() { this.getProCateList() axios({ url: "api/main/system/user/show", method: "get" }) .then(resp => { this.user = resp.data.list; console.log(this.user); }) .catch(er => { console.log(er); }); } ``` 这是catch到的错误 ![图片说明](https://img-ask.csdn.net/upload/201910/29/1572317773_834152.png)
vue中使用graphql,刚接触,不太明白,往各位大神指教
XXX.vue ``` import apollo from '../configuration/list.js' .... methods:{ handleList: function() { this.$apollo.query({ query: apollo, variables: { model: this.chooseModelCode || '', name: this.moduleInputName || '', pageSize: this.pageInfo.pageSize || 10, pageNum: this.pageInfo.pageNum || 1 } }).then(res => { console.log(res.data) this.Parse(res.data.result) console.log(res.data.result) }).catch(err => { console.log(err) }) }, } ``` list.js ``` import gql from 'graphql-tag' const apollo = gql `query result($model: String,$name: String,$pageSize: Int!,$pageNum: Int!){ result(model:$model,name:$name,pageSize:$pageSize,pageNum:$pageNum){ list{ name gmtCreate model } pageSize pageNum } }` export default apollo ``` 应该是哪里写的不对,老是报错 Network error: Server response was missing for query 'result'.
vue+iview分页输入页码跳转问题?
这是我得父组件 ``` <template> <div class="table-wrap"> <Table ref="table" :data="arrList" :columns="currColumns" :loading="loading" no-data-text="暂时没有数据" @on-selection-change="handleSelectChange" ></Table> <div class="table-page" v-show="pageable"> <!-- <span>{{ page.currPageSize }}</span> --> <Page :total="page.currTotal" :current="page.currCurrent" show-total show-elevator transfer :page-size-opts="[10,20,30]" @on-page-size-change="pagesizechange" show-sizer placement="top" @on-change="pageChange" > <span style="">共{{ page.currTotal }}条</span> <span>{{ pageNum }} 条 / 页 共{{page.totalPageCount}}页</span> </Page> </div> </div> </template> <script> export default { name: "dtTable", props: { url: String, params: { type: Object, default() { return {}; } }, columns: { type: Array, default() { return []; } }, pageable: { type: Boolean, default: true } }, data() { return { loading: false, currUrl: this.url, currParams: this.params, currColumns: this.columns, arrList: [], page: { currTotal: 0, currCurrent: 1, currPageSize: 10, totalPageCount:1, }, selection: [], pageNum: "", tableResult: "" }; }, watch: { arrList(val) { this.pageNum = val.length; }, params(val) { this.currParams = val; this.getList(); } }, computed: {}, mounted() { this.getList(); }, methods: { getList() { this.selection = []; this.loading = true; var param = Object.assign({}, this.currParams, { pageNo: this.page.currCurrent, pageSize: this.page.currPageSize }); this.$http.post(this.currUrl, param).then(res => { this.loading = false; this.arrList = res.data.list; this.tableResult = res.data; // this.arrList = res.data; if( Number(res.data.totalCount) == "NaN"){ this.page.currTotal = 0; }else{ this.page.currTotal = Number(res.data.totalCount); console.log(this.page.currTotal); this.page.totalPageCount = Number(res.data.totalPageCount); } this.page.currPageSize = Number(res.data.list.length); }); }, pageChange(num) { this.page.currCurrent = num; this.getList(); }, pagesizechange(pageSize){ this.page.currPageSize = pageSize; this.getList(); }, handleSelectChange(selection) { this.selection = selection; }, // 返回选中数组,默认是id getSelect(key = "id") { return this.selection.map(item => item[key]); } }, activated() { // isUseCache为false时才重新刷新获取数据 // 因为对list使用keep-alive来缓存组件,所以默认是会使用缓存数据的 if(!this.$route.meta.isUseCache){ this.arrList = []; // 清空原有数据 this.getList(); // 这是我们获取数据的函数 } }, }; </script> <style lang="less" scoped> .table-wrap { padding: 0px 20px; .table-page { text-align: right; padding: 20px 0px; } } </style> ``` 子组件 ``` <dt-table ref="table" url="/findTShopInfoTies" :params="params" :columns="columns" @on-selection-change="handleSelectChange"></dt-table> ``` 输入页码 ![图片说明](https://img-ask.csdn.net/upload/201911/22/1574388632_791158.png) 不管输入几都变为1
就是多线程处理list;以下代码如何能保证list安全呢
package com.gray.test; import java.util.ArrayList; import java.util.List; import java.util.concurrent.*; public class ThreadTest { public static void main(String[] args) throws Exception { // 开始时间 long start = System.currentTimeMillis(); // 模拟数据List List<String> list = new ArrayList<String>(); for (int i = 0; i < 3000; i++) { list.add(i + ""); } ExecutorService exec = Executors.newFixedThreadPool(3); CountDownLatch doneSignal = new CountDownLatch(3); exec.execute(new PoiWriter(doneSignal,list,0,999)); exec.execute(new PoiWriter(doneSignal,list,1000,1999)); exec.execute(new PoiWriter(doneSignal,list,2000,2999)); doneSignal.await(); exec.shutdown(); System.out.println("执行任务消耗了 :" + (System.currentTimeMillis() - start) + "毫秒"); } protected static class PoiWriter implements Runnable { private CountDownLatch doneSignal; private List list; private int start; private int end; public PoiWriter(CountDownLatch doneSignal,List list, int start, int end) { this.doneSignal = doneSignal; this.start = start; this.list = list; this.end = end; } @Override public void run() { try { for (int i = start; i <= end ;i++) { list.set(i, Thread.currentThread().getName() +"<--------->" + list.get(i)); System.out.println(list.get(i)); } } catch (Exception e) { e.printStackTrace(); } finally { doneSignal.countDown(); } } } }
webservlet在doGet中 不执行 req.getRequestDispatcher(USER_VIEW).forward(req,resp),一直在doget里面循环
``` @WebServlet( urlPatterns = {"/user/*"}, initParams = { @WebInitParam(name = "USER_VIEW",value = "user.jsp") } ) public class User extends HttpServlet { private String USER_VIEW; public void init(){ USER_VIEW = getServletConfig().getInitParameter("USER_VIEW"); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { UserService userService = (UserService) getServletContext().getAttribute("userService"); String usrname = req.getPathInfo().substring(1); if(userService.isUerExisted(usrname)){ Blah blah = new Blah(); blah.setUsername(usrname); List<Blah> blahs = userService.getBlahs(blah); req.setAttribute("blahs",blahs); } req.setAttribute("username",usrname); req.getRequestDispatcher(USER_VIEW).forward(req,resp); } ``` USER_VIEW 是 user.jsp 页面. 在浏览器请求:http://localhost:8080/wbojsp/user/liming 请求大神支援!
hibernatetemplate查询会有sql注入问题吗?
String hql = "SELECT u.userName FROM User u WHERE u.userName = ?"; List userList=this.getHibernateTemplate().find(hql,user.getUserName()); 如果有请问怎么解决?
struts2中action与jsp无法进行数据交互
__问题一:action 的数据不能传到jsp 浏览器输入http://localhost:8080/itcastTax/nsfw/user_listUI.action访问listUI.jsp的结果如下: ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203332_205503.png) 1. 不能将数据库的user显示出来 2.从Debug可以看到action已经从数据库的数据取到listuser ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203359_495138.png) __问题二:jsp的数据不能传到action 1. 在listUI.jsp点击"新建"进入addUI.jsp,输入数据点击保存,在数据库的user并没有添加。 2.debug看到UserAaction.add()方法取到的user为空: ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203388_937299.png) ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505204032_739445.png) 关键代码如下: User.java: package cn.itcast.nsfw.user.entity; import java.io.Serializable; import java.util.Date; public class User implements Serializable { private String id ; private String name; private String dept ; private String account ; private String password ; private String headImg ; private boolean gender; private String email; private String mobile; private Date birthday; private String state; private String memo; public static String USER_STATE_VALID = "1"; public static String USER_STATE_INVALID = "0"; public User() { super(); // TODO Auto-generated constructor stub } public User(String id, String name, String dept, String account, String password, String headImg, boolean gender, String email, String mobile, Date birthday, String state, String memo) { super(); this.id = id; this.name = name; this.dept = dept; this.account = account; this.password = password; this.headImg = headImg; this.gender = gender; this.email = email; this.mobile = mobile; this.birthday = birthday; this.state = state; this.memo = memo; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHeadImg() { return headImg; } public void setHeadImg(String headImg) { this.headImg = headImg; } public boolean isGender() { return gender; } public void setGender(boolean gender) { this.gender = gender; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } UserAction.java: package cn.itcast.nsfw.user.action; import java.util.List; import javax.annotation.Resource; import org.junit.Test; import cn.itcast.nsfw.user.entity.User; import cn.itcast.nsfw.user.service.UserService; import com.opensymphony.xwork2.ActionSupport; public class UserAction extends ActionSupport { private static final User User = null; @Resource private UserService userService; private List userList; private User user; //列表页面 public String listUI(){ userList = userService.findobjects(); return "listUI"; } //跳转新增页面 public String addUI(){ return "addUI"; } //保存新增 public String add(){ if(user !=null){ userService.save(user); } return "list"; } . . . listUI.jsp ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203461_133898.png) addUI.jsp ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203427_408071.png) strusr.xml ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505203552_595218.png)
struts2 中actiong与jsp不能进行数据交互
User.java: package cn.itcast.nsfw.user.entity; import java.io.Serializable; import java.util.Date; public class User implements Serializable { private String id ; private String name; private String dept ; private String account ; private String password ; private String headImg ; private boolean gender; private String email; private String mobile; private Date birthday; private String state; private String memo; public static String USER_STATE_VALID = "1"; public static String USER_STATE_INVALID = "0"; public User() { super(); // TODO Auto-generated constructor stub } public User(String id, String name, String dept, String account, String password, String headImg, boolean gender, String email, String mobile, Date birthday, String state, String memo) { super(); this.id = id; this.name = name; this.dept = dept; this.account = account; this.password = password; this.headImg = headImg; this.gender = gender; this.email = email; this.mobile = mobile; this.birthday = birthday; this.state = state; this.memo = memo; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHeadImg() { return headImg; } public void setHeadImg(String headImg) { this.headImg = headImg; } public boolean isGender() { return gender; } public void setGender(boolean gender) { this.gender = gender; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } UserAction.java: package cn.itcast.nsfw.user.action; import java.util.List; import javax.annotation.Resource; import org.junit.Test; import cn.itcast.nsfw.user.entity.User; import cn.itcast.nsfw.user.service.UserService; import com.opensymphony.xwork2.ActionSupport; public class UserAction extends ActionSupport { private static final User User = null; @Resource private UserService userService; private List<User> userList; private User user; //列表页面 public String listUI(){ userList = userService.findobjects(); return "listUI"; } //跳转新增页面 public String addUI(){ return "addUI"; } //保存新增 public String add(){ if(user !=null){ userService.save(user); } return "list"; } . . . } listUI.jsp package cn.itcast.nsfw.user.entity; import java.io.Serializable; import java.util.Date; public class User implements Serializable { private String id ; private String name; private String dept ; private String account ; private String password ; private String headImg ; private boolean gender; private String email; private String mobile; private Date birthday; private String state; private String memo; public static String USER_STATE_VALID = "1"; public static String USER_STATE_INVALID = "0"; public User() { super(); // TODO Auto-generated constructor stub } public User(String id, String name, String dept, String account, String password, String headImg, boolean gender, String email, String mobile, Date birthday, String state, String memo) { super(); this.id = id; this.name = name; this.dept = dept; this.account = account; this.password = password; this.headImg = headImg; this.gender = gender; this.email = email; this.mobile = mobile; this.birthday = birthday; this.state = state; this.memo = memo; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHeadImg() { return headImg; } public void setHeadImg(String headImg) { this.headImg = headImg; } public boolean isGender() { return gender; } public void setGender(boolean gender) { this.gender = gender; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } } addUI.jsp: package cn.itcast.nsfw.user.entity; import java.io.Serializable; import java.util.Date; public class User implements Serializable { private String id ; private String name; private String dept ; private String account ; private String password ; private String headImg ; private boolean gender; private String email; private String mobile; private Date birthday; private String state; private String memo; public static String USER_STATE_VALID = "1"; public static String USER_STATE_INVALID = "0"; public User() { super(); // TODO Auto-generated constructor stub } public User(String id, String name, String dept, String account, String password, String headImg, boolean gender, String email, String mobile, Date birthday, String state, String memo) { super(); this.id = id; this.name = name; this.dept = dept; this.account = account; this.password = password; this.headImg = headImg; this.gender = gender; this.email = email; this.mobile = mobile; this.birthday = birthday; this.state = state; this.memo = memo; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHeadImg() { return headImg; } public void setHeadImg(String headImg) { this.headImg = headImg; } public boolean isGender() { return gender; } public void setGender(boolean gender) { this.gender = gender; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } } user-struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="user" namespace="/nsfw" extends="struts-default"> <action name="user_*" class="cn.itcast.nsfw.user.action.UserAction" method="{1}"> <result name="{1}">/WEB-INF/jsp/nsfw/user/{1}.jsp</result> <result name="list" type="redirectAction"> <param name="actionName">user_listUI</param> <param name="user.name">${strName}</param> <param name="encode">true</param> </result> </action> </package> </struts> 问题一:action 的数据不能传到jsp 浏览器输入http://localhost:8080/itcastTax/nsfw/user_listUI.action访问listUI.jsp的结果如下: ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505200739_870221.png) 1. 不能将数据库的user显示出来 2.从Debug可以看到action已经从数据库的数据取到listuser ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505201430_13218.png) 问题二:jsp的数据不能传到action 在listUI.jsp点击新建进入addUI.jsp,输入数据点击保存,在数据库的user并没有添加。 ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505201636_732242.png)
解決vue-element-admin mock 模擬數據不顯示問題(已經解決)
``` const List = [] const count = 100 for (let i = 0; i < count; i++) { List.push(Mock.mock({ id: '@id', title: '@sentence(10, 20)', 'status|1': ['published', 'draft', 'deleted'], author: 'name', category: 'MT-@integer(1,1000)', createdate: '@date', number: 'MT-@integer(10, 100)', opeater: 'simon@integer(500,800)', amount: '$@integer(500,5000)', type: 'MF-@sentence(10, 20)', name: 'MA-@sentence(1, 20)', qutodate: '@date' })) } export default [ { url: '/table/list', type: 'get', response: config => { const { importance, type, title, page = 1, limit = 20 ,sort} = config.query let mockList = List.filter(item => { if(importance && item.importance !== +importance) return false if(type && item.type !== type) return false if(title && item.title.indexOf(title) < 0) return false return true }) if (sort === '-id') { mockList = mockList.reverse() } const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page -1)) return { code: 20000, data: { total: mockList.length, items: pageList } } } }, ``` ``` <el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%; margin-top: 20px" > <el-table-column align="center" label="ID" width="85" prop="id" :class-name="getSortClass('id')"> <template slot-scope="row"> {{ row.id }} </template> </el-table-column> <el-table-column align="center" label="類別" prop="category"> <template slot-scope="{row}"> {{ row.category }} </template> </el-table-column> </el-table> created() { this.fetchData() }, methods: { fetchData() { this.listLoading = true getList(this.listQuery).then(response => { this.list = response.data.items this.total = response.data.total console.log(this.list) setTimeout(() => { this.listLoading = false }, 1000) }) } } ``` 沒有數據顯示 請問各位大神知道什麼原因嘛
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
《阿里巴巴开发手册》读书笔记-编程规约
Java编程规约命名风格 命名风格 类名使用UpperCamelCase风格 方法名,参数名,成员变量,局部变量都统一使用lowerCamelcase风格 常量命名全部大写,单词间用下划线隔开, 力求语义表达完整清楚,不要嫌名字长 ...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Linux 命令(122)—— watch 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] watch(1) manual
Linux 命令(121)—— cal 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] cal(1) manual
记jsp+servlet+jdbc实现的新闻管理系统
1.工具:eclipse+SQLyog 2.介绍:实现的内容就是显示新闻的基本信息,然后一个增删改查的操作。 3.数据库表设计 列名 中文名称 数据类型 长度 非空 newsId 文章ID int 11 √ newsTitle 文章标题 varchar 20 √ newsContent 文章内容 text newsStatus 是否审核 varchar 10 news...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问