spring security3.2.6 sessionRegistry获取所有在线用户返回为空 5C

security.xml关键配置如下

 <bean id="concurrencyFilter"
      class="org.springframework.security.web.session.ConcurrentSessionFilter">
        <property name="sessionRegistry" ref="sessionRegistry" />
        <property name="expiredUrl" value="/session-expired.htm" />
    </bean>

    <!--sessionRegistry-->
    <bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy">
        <constructor-arg name="sessionRegistry" ref="sessionRegistry" />
        <property name="maximumSessions" value="1"></property>
        <property name="exceptionIfMaximumExceeded" value="true"></property> 
    </bean>    

    <bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" /> 
        <bean id="fromLoginFilter"
        class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
        <property name="sessionAuthenticationStrategy" ref="sas"/><!-- 此配置可实现获取所有登录用户信息 -->
        <property name="authenticationManager" ref="authenticationManager" />
        <property name="authenticationFailureHandler" ref="fromFailureHandler" />
        <property name="filterProcessesUrl" value="/old/login" />
    </bean>

利用sessionRegistry.getAllPrincipals();返回的list是空,求解

2个回答

sessionRegistry 这一行配置文件最后标签关闭了,后面的配置应该不起作用了吧

sessionRegistry 这一行配置文件最后标签关闭了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring security3.2.6 jar包
Spring Security3.2.6 jar包资源
spring aop @Around 返回参数值为空
在做 spring 项目中用到aop ,拦截前端请求后AOP中@Around 处理后返回参数为空。通过检查接口层Controller方法返回类型为void造成的,返回值改为一致就没问题了。 ...
spring获取数据源dataSource为空null
spring配置文件:rn[code=text] rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn com.mysql.jdbc.Driver rn rn rn jdbc:mysql://127.0.0.1:3306/memo rn rn rn root rn rn rn 123456 rn rn rn rn rn rn rn rn rn rn rn rn rn rn /html/ rn .jsp rn rn rn rn [/code]rnrn一个测试类:rn[code=java]rnprivate static final Logger log = Logger.getLogger(ConnectionFactory.class); rn rn private DataSource dataSource; rn rn public void setDataSource(DataSource dataSource) rn this.dataSource = dataSource; rn rn public DataSource getDataSource() rn return this.dataSource; rn rn rn public void query()throws Exception rn log.info("dataSource:"+dataSource); rn Connection conn = dataSource.getConnection(); rn System.out.println("conn:"+conn); rn rn public static void main(String[] args) throws Exception rn new ConnectionFactory().query(); rn rn[/code]rn这个Test类中一直不能获取dataSource,dataSource为空,但是如果不用配置文件,直接在Test类中新建dataSource设置参数如:rn[code=java]rndataSource.setDriverClassName("com.mysql.jdbc.Driver"); rndataSource.setUrl("jdbc:mysql://127.0.0.1:3306/memo"); rndataSource.setUsername("root"); rndataSource.setPassword("123456"); rnConnection conn = dataSource.getConnection(); rn[/code]rn就可以获得dataSource,请各位帮帮我,这个问题是什么引起的,该怎么解决,谢谢!rnjar包截图:[img=https://img-bbs.csdn.net/upload/201405/05/1399292514_851277.jpg][/img]
dlsym()返回为空
handle = dlopen(libname, RTLD_NOW);打开库handle返回不为空,dlerror()为空,说明打开so库没有出错rn rn 下面使用函数dlsym()获取函数:rn rn fptr = dlsym(handle, "omx_component_library_Setup");rn rn fptr返回为空,而且dlerror()也为空??rnrn什么原因啊?
返回json数据为空
struts2的action代码如下:rn package ajaxaction;rnrnimport java.util.ArrayList;rnimport java.util.List;rnrnimport po.Weeks;rnrnimport service.Weeksservice;rnrnimport org.apache.struts2.json.annotations.JSON;rnrnimport action.Action;rnrnpublic class Showweekaction implements Action rn private String username;rn private String date;rn private Weeksservice ws;rn private [color=#FF0000]List weekslist[/color];rn rnrn public String getUsername() rn return username;rn rnrn public void setUsername(String username) rn this.username = username;rn rnrn public String getDate() rn return date;rn rnrn public void setDate(String date) rn this.date = date;rn rn @JSON(serialize=false)rn public Weeksservice getWs() rn return ws;rn rnrn public void setWs(Weeksservice ws) rn this.ws = ws;rn rnrn [color=#FF0000]@JSON(serialize=false)rn public List getWeekslist() rn return weekslist;rn [/color]rn public void setWeekslist(List weekslist) rn this.weekslist = weekslist;rn rnrn public String execute() rn weekslist=new ArrayList();rn weekslist=ws.getweek(username,date);rn System.out.print(weekslist.size());rn return SUCCESS;rn rnrnjsp中javascript如下:rn function fun()rn $.ajax(rn url:"ajaxshowweek",rn data:username:"zxl",date:"2011-04-06",rn type:'post',rn dataType:'json',rn success:function(data)rn var jsonobject=data.weekslist;rn $.each(jsonobject,function(key,value)rn alert(key+" "+value.event);rn ) rn ,rn error:function()rn alert("失败");rn rn );rn rn struts.xml:rn rn rn rn rn rn 我在控制台里查了一下weekslist的长度为2,说明它不为空。(weekslist是从数据库里取出来的,ws是业务逻辑还有dao层)但是在js里用each遍历什么也没有输出……rn 我还想问一下这个serialize(序列化)到底是干什么的,就是变成key:value模式?
返回的值为空?
为何像如下的代码写返回值绑定到Total里。看不到绑定内容呢?rnprivate void Page_Load(object sender, System.EventArgs e) rnif(IsPostBack)rn rn id = Convert.ToInt32(ddlName.SelectedValue.ToString());rnrn Total.Text = myVisit.GetTotal(id);rnrn rn rn public string GetTotal(int id)rn rn string sqlTotal = "Select Sum(Count_Visit) as Total from Visit_Day where [userid] = " + id.ToString();rn tryrn rn string count = ExecuteSql4String(sqlTotal);rn return count;rn rn catchrn rn return null;rn rn rnrn以下是ExecuteSql4String()方法:rnprotected string ExecuteSql4String(string strSQL)rn rn //SqlConnection myCn = new SqlConnection(strConn); rn SqlCommand myCmd = new SqlCommand(strSQL,myCn);rn tryrn rn myCn.Open();rn object r = myCmd.ExecuteScalar();rn if(Object.Equals(r,null))rn rn throw new Exception("value unavailable!");rn rn elsern rn return (string)r;rn rn rn catch(System.Data.SqlClient.SqlException e)rn rn throw new Exception(e.Message);rn rn finallyrn rn myCmd.Dispose();rn myCn.Close();rn rn rnrn谢谢!
GetDlgItem 返回为空
我用GetDlgItem 获取一个对话框中一个BUTTON的指针,结果为空,请问这怎么回事呀
Spring 注入为空
在一个SSH的项目中遇到一个问题,我有一个dao的接口BaseJdbcDao,和一个dao的实现类BaseJdbcDaoImpl,实现类已经通过注解提交给容器进行管理,然后有一个工具类MailHelper想通过自动装配载入dao的实现类,可是每次都没有装配成功,代码如下,请教各位:rn[code="java"]rnpackage base;rnimport java.util.List;rnimport java.util.Map;rnimport org.springframework.jdbc.support.rowset.SqlRowSet;rnpublic interface BaseJdbcDao rnrn public abstract List queryForList(String sql);rnrn public abstract int queryForInt(String sql);rnrn public abstract SqlRowSet queryForRowSet(String sql);rnrn public abstract int update(String sql);rnrn public abstract Map queryForMap(String sql);rnrn public abstract void delete(String sql);rn rn public abstract void insert(String sql);rnrn[/code]rn[code="java"]rnpackage base.impl;rnimport java.util.List;rnimport java.util.Map;rnimport org.springframework.jdbc.core.JdbcTemplate;rnimport org.springframework.jdbc.support.rowset.SqlRowSet;rnimport base.BaseJdbcDao;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.stereotype.Repository;rnrn@Repository("basejdbcdao") rnpublic class BaseJdbcDaoImpl implements BaseJdbcDao rnrn private JdbcTemplate jdbcTemplate;rnrn public JdbcTemplate getJdbcTemplate() rn return jdbcTemplate;rn rn rn @Autowiredrn public void setJdbcTemplate(JdbcTemplate jdbcTemplate) rn this.jdbcTemplate = jdbcTemplate;rn rnrn public List queryForList(String sql)rn System.out.println(sql);rn return this.getJdbcTemplate().queryForList(sql);rn rn rn public int queryForInt(String sql)rn System.out.println(sql);rn return this.getJdbcTemplate().queryForInt(sql);rn rn rn public SqlRowSet queryForRowSet(String sql)rn System.out.println(sql);rn return this.getJdbcTemplate().queryForRowSet(sql);rn rn rn public int update(String sql)rn System.out.println(sql);rn return this.getJdbcTemplate().update(sql);rn rn rn public Map queryForMap(String sql)rn System.out.println(sql);rn return this.getJdbcTemplate().queryForMap(sql);rn rn rn public void delete(String sql)rn System.out.println(sql);rn this.getJdbcTemplate().update(sql);rn rn rn public void insert(String sql)rn System.out.println(sql);rn this.getJdbcTemplate().execute(sql);rn rnrn[/code]rn[code="java"]package util;rnimport java.io.IOException;rnimport java.util.HashMap;rnimport java.util.Properties;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.beans.factory.annotation.Qualifier;rnimport org.springframework.jdbc.support.rowset.SqlRowSet;rnimport java.util.Date;rnimport javax.activation.DataHandler;rnimport javax.mail.Authenticator;rnimport javax.mail.Message;rnimport javax.mail.Session;rnimport javax.mail.Transport;rnimport javax.mail.internet.InternetAddress;rnimport javax.mail.internet.MimeMessage;rnimport util.ByteArrayDataSource;rnimport javax.mail.PasswordAuthentication;rnimport base.BaseJdbcDao;rnimport base.impl.BaseJdbcDaoImpl;rnrnpublic class MailHelper rn rn @Autowiredrn @Qualifier("basejdbcdao")rn private BaseJdbcDao dao;rn rn private String email;rn private String mobile;rn private String school;rn private String name;rn private String remark;rn private String appstr; rn rn public MailHelper(String school,String name,String mobile,String email,String remark,String appstr)rn this.email = email;rn this.mobile = mobile;rn this.school = school;rn this.name = name;rn this.remark = remark;rn this.appstr = appstr;rn rn rn public MailHelper();rn rn public void sendMail()rn this.insertData(school,name,mobile,email,remark,appstr);rn rn rn rn rn /**rn * 帐号申请的功能rn * @param templatern * @param pschoolrn * @param pnamern * @param pmobilern * @param pemailrn * @param premarkrn */rn public void insertData(String pschool,String pname,String pmobile,String pemail,String premark,String appstr)rn String email = changeContent( pemail);rn String mobile = changeContent( pmobile);rn String school =changeContent (pschool);rn String name =changeContent (pname);rn String remark = changeContent (premark);rn String to = "test@163.com";rn String subject = "申请";rn StringBuilder sb = new StringBuilder("insert into maillist(linkman,school,mobile,mail,remark)values('"+name+"','"+school+"','"+mobile+"','"+email+"','"+remark+"')");rn dao.update(sb.toString());rn remark = "内容略。。";rn this.send( to, subject, remark);rn rnrn /**rn * Sending a mail with given values. rn * content parameter means the main email text,it refers to a html file. rn * rn * @param smtpServerrn * @param torn * @param fromrn * @param subjectrn * @param contentrn * @param emailUsernamern * @param emailUserpassrn * @author WYQrn */ rn private String send(String to,String subject,String content) rn try rn HashMap map = readParamters();rn String smtpserver = map.get("smtpserver");rn String publicaccount = map.get("publicaccount");rn String publicpwd = map.get("publicpwd");rn String from = map.get("publicmail");rn rn Properties props = System.getProperties();rn props.put("mail.smtp.port", "25");rn props.put("mail.smtp.starttls.enable","false");rn props.put("mail.smtp.auth", "true");rn props.put("mail.smtp.host", smtpserver);rn rn Session session = null;rn session = Session.getDefaultInstance(props,new PasswordAuthenticator(publicaccount,publicpwd));rn rn Message msg = new MimeMessage(session);rn msg.setFrom(new InternetAddress(from));rn msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse( to, false));rn msg.setSubject(subject);rn msg.setDataHandler(new DataHandler(new ByteArrayDataSource(content,"text/html; charset=\"utf-8\"")));rn msg.setHeader("X-Mailer", "XML-Mail");rn msg.setSentDate(new Date());rn // -- Send the message --rn Transport.send(msg);rn return "success";rn catch (Exception ex) rn return "Error" + ex;rn rn rn rn rn private HashMap readParamters()rn HashMap map = new HashMap();rn Properties properties =new Properties();rn try rn properties.load(MailHelper.class.getClassLoader().getResourceAsStream("mail.properties"));rn map.put("smtpserver", properties.getProperty("smtpserver"));rn map.put("publicmail", properties.getProperty("publicmail"));rn map.put("publicaccount", properties.getProperty("publicaccount"));rn map.put("publicpwd", properties.getProperty("publicpwd"));rn catch (IOException e) rn e.printStackTrace();rn rn return map;rn rnrnrn class PasswordAuthenticator extends Authenticator rn private String username;rn private String password;rnrn public PasswordAuthenticator(String username, String password) rn this.username = username;rn this.password = password;rn rn protected PasswordAuthentication getPasswordAuthentication() rn return new PasswordAuthentication (username, password);rn rnrnrn[/code]rn然后我在struts的action类中调用MailHelper的send方法进行邮件发送时,打印的dao总是为空,action的代码是:rn[code="java"]rn /**rn * 帐号申请-邮件发送rn * @returnrn */rn public String sendMail()rn MailHelper mh = new MailHelper();rn mh.sendMail();rn success = true;rn return SUCCESS;rn rn[/code]rnspring的自动扫描和注解配置已经开启,也已经把dao的package路径和MailHelper的package路径加入到基类中了,rn[code="java"]rnrn[/code]rn现在就是弄不明白,为什么通过new出来的MailHelper对象中注入的dao总是为空呢。
openfire如何获取所有在线用户
想象中如此简单的功能,想不到却这般大费周折。 如要实现,必须先确保: 1. openfire中安装有“Presence” 插件。   2. 确保该插件设置可允许任何人访问(如果是跨域浏览的话)   然后通过如下方式访问:http://www.igniterealtime.org/projects/openfire/plugins/presence/readme.html 。 ...
openfire获取所有在线用户插件
自己写的获取所有在线用户的openfire插件,直接上传到openfire服务器即可使用,访问路径为host:port/plugins/onlines/listall
怎么获取所有在线用户详细信息???
以前没接触过,最近在用,在这里遇到了问题,请问怎么样才能获得当前在线人数以及用户信息????rn知道的大虾们给我点帮助吧。。。
spring mvc获取和返回
1. 获取参数 username: password: @Controller public class UserController { /*** * @param username * @param password * @return */ @RequestMapping(value="login",method=Req
为什么_RecordsetPtr返回为空
::CoInitialize(NULL);// 初始化OLE/COM库环境 ,为访问ADO接口做准备rn _RecordsetPtr pRecordset;rn DataDAL::m_PConnect.CreateInstance("ADODB.Connection");rn DataDAL::m_PConnect->Open(DataDAL::m_DDBConString,"","",adModeUnknown);rn lTrans=m_PConnect->BeginTrans();rn pRecordset.CreateInstance(__uuidof(Recordset));rn _CommandPtr pCom;rn pCom.CreateInstance(__uuidof(Command));rn pCom->ActiveConnection=DataDAL::m_PConnect;rn DataDAL::m_PConnect->CursorLocation=adUseClient;rn pCom->CommandType=adCmdStoredProc;rn pCom->CommandText=_bstr_t("测试用");rn //添加参数rn _ParameterPtr pParam;rn pParam.CreateInstance(__uuidof(Parameter));rn pParam->Direction=adParamInput;rn pParam->Name="@Test_ID";rn pParam->Type=adVarChar;rn pParam->Size =20;rn pParam->Value=pTestID;//传入的值rn pCom->Parameters->Append(pParam);rn pRecordset=pCom->Execute(NULL,NULL,adCmdStoredProc);rn DataDAL::m_PConnect->CommitTrans();rn rn //。。处理pRecordsetrn //...........rn rn if(DataDAL::m_PConnect->State)rn DataDAL::m_PConnect->Close();rnrn*****************************************************************rn以下是存储过程rnCreate PROCEDURE 测试用rn(rn @Test_ID varchar(20)rn)rnASrnbeginrn insert into 表名(ID,[datetime])rn select '0000000000',getdate()rn select * from 表名rnendrn-------------------------------------------------------------------------------rn问题:rn操作pRecordset时,提示对象关闭;也就是说pCom->Execute没有返回任何东西,rn我查了下数据库 insert语句已经执行过,按道理select * from 表名也因该正常执行了rn但为何pCom->Execute没有正常返回记录集呢?rn
CMenu.GetSubMenu 返回为空的问题
hi allrn今天碰到这个问题头疼了一天, 代码如下:rn[code=C/C++]void CGaiJianDlg::OnNMRClickLstkeys(NMHDR *pNMHDR, LRESULT *pResult)rnrn NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;rn if(pNMListView->iItem == -1)rn rnrn rn else rn rn CMenu menu;rn CPoint pt;rn menu.LoadMenu(IDR_MENU1);rn GetCursorPos(&pt); rn menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, this); rn //destroyrn HMENU hmenu=menu.Detach(); rn menu.DestroyMenu(); rn rn *pResult = 0;rn[/code]rnrnmenu.LoadMenu(IDR_MENU1); 返回1rnmenu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, this); 出错rn检查发现menu.GetSubMenu(0)为空, 故TrackPopupMenu中断言抛出异常rnUnhandled exception at 0x7863e87e (mfc90d.dll) in Test.exe: 0xC0000005: Access violation reading location 0x00000004.rnrn其中IDR_MENU1为我在视图中新建的Menu的ID, 并且之前是可以运行成功的, 后来不知道为什么就不行了。rnrn急盼大家帮我解决, 谢谢!rn
查询为空返回什么
查询为空时 返回的是 null 还是 '' 呵呵 大家别笑我~谢过
SHLoadImageFile 返回句柄为空
我把6张1600x1000的图PS成一张 1600x6000的,不知道什么的SHLoadImageFile加载位图都返回时空?我用一张一张加载都没问题。哪位能指点下呀!
为什么DataTable.GetChanges()返回为空
我的DataGrid绑定DataTable tb,当只有一行记录时我在界面上修改该行,再调用tb.GetChanges()返回的为null,应该返回有一行的表呀
LoadLibrary 返回指针为空
DLL路径正确,但LoadLibrary 返回指针为空,DLL是在本机重新生成的,是什么原因呢?万分感谢
MessageQueue 返回对象为空
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(@".\Private$\OrderQueue");rn queue.Formatter = new XmlMessageFormatter(new Type[] typeof(order) );rn MessageEnumerator messageEnum = queue.GetMessageEnumerator2();rn while (messageEnum.MoveNext())rn rn if (messageEnum.Current.Label == Labels)rn rn String id = messageEnum.Current.Id;rn order ord = new order();rn System.Messaging.Message message_ord=queue.ReceiveById(id);rn ord =(order) message_ord.Body;rn return ord;rn rn rn这样写Order类里面是空值,但是队列里面有对象,跪求大神,到底怎么返回对象才是正确的。
接口调用返回的结果为空
public function login()rn header("Content-Type:text/html;charset=utf-8");rn $user = I('username');rn $passwd = md5(md5(I('password')));rn $url = 'http://daili.ipduoduo.com:33332/api/userinfo';rn $params = array(rn "user" => $user,rn "password" => $passwd,rn );rnrn //初始化rn $curl = curl_init();rn //设置抓取的urlrn if(!empty($params))rn foreach ($params as $key => $value) rn $url .= '?'.$key.'='.$value;rn rn curl_setopt($curl, CURLOPT_URL, $url);rn elsern curl_setopt($curl, CURLOPT_URL, $url);rn rn var_dump($url);die;rn // elsern rn // rn //设置头文件的信息作为数据流输出rn curl_setopt($curl, CURLOPT_HEADER, 1);rn //设置获取的信息以文件流的形式返回,而不是直接输出。rn curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);rn //执行命令rn $data = curl_exec($curl);rn //关闭URL请求rn curl_close($curl);rn //显示获得的数据rn // print_r($data);die;rn //对结果进行美化rn list($header, $body) = explode("\r\n\r\n", $data, 2);rn preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);rn $info['cookie'] = substr($matches[1][0], 1);rn $info['content'] = $body;rn // var_dump($body);die;rn //json强制转化为数据rn $json_array = json_decode($body,true);rn // var_dump($json_array);die;rn echo "pre";rn print_r($json_array['data']['userInfo']['nickname']);rn echo "pre";die;rn if($json_array->status == -1)rn var_dump('密码与账号不一致');die;rn elsern $this->display('Index/index');rn rn
返回ResultSet ,为什么为空?
自己写的DBConnection类,里面有个方法exeQuery返回的是ResultSet,如下:rn[code=Java]rnpublic static ResultSet exeQuery(String sql)throws SQLExceptionrn ResultSet result=null;rn Connection conn=DBConnection.getConnection();rn tryrn Statement state=conn.createStatement();rn result=state.executeQuery(sql); rn state.close();rn conn.close();rn catch(Exception e)rn e.printStackTrace();rn } rn return result;rnrn[/code]rn为什么这个函数总是没有返回值?
存储过程返回参数为空
在数据交换层的代码,下面红色部分写的应该是没问题吧,可是我在界面层调用这个的时候返回来的2个都是“0”啊,怎么会这样,但是其他数据都可以接到,就是这2个为0,而且我的存储过程是没问题的,不用三层架构的时候可以返回这2个数。代码如下:rn[code=C#] public DataSet PageDs(PageCut PC, out int pagecount, out int recordcount)rn rn StringBuilder sb = new StringBuilder();rn sb.Append("GetRecordFromPage");rn SqlParameter[] parm =new SqlParameter("@tbname",SqlDbType.VarChar,255),rn new SqlParameter("@FieldShow",SqlDbType.VarChar,255),rn new SqlParameter("@FieldKey",SqlDbType.VarChar,255),rn new SqlParameter("@FieldOrder",SqlDbType.VarChar,255),rn new SqlParameter("@Where",SqlDbType.VarChar,2000),rn new SqlParameter("@pageSize",SqlDbType.Int,4),rn new SqlParameter("@PageCurrent",SqlDbType.Int,4),rn new SqlParameter("@RecordCount",SqlDbType.Int,4),rn new SqlParameter("@PageCount",SqlDbType.Int,4);rn parm[0].Value = PC.tbname;rn parm[1].Value = PC.FieldShow;rn parm[2].Value = PC.FieldKey;rn parm[3].Value = PC.FieldOrder;rn parm[4].Value = PC.Where;rn parm[5].Value = PC.pagesize;rn parm[6].Value = PC.PageCurrent;rn[color=#FF0000] parm[7].Direction = ParameterDirection.Output;rn parm[8].Direction = ParameterDirection.Output;[/color]rn [color=#FF0000]pagecount =Convert.ToInt32(parm[8].Value);rn recordcount = Convert.ToInt32(parm[7].Value);[/color] return SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringLocalTransaction,CommandType.StoredProcedure,sb.ToString(),parm);rn [/code]
GetClientRect返回为空【求助】
在OnDraw()中调用GetClientRect()为一个RECT结构赋值,结果得到的RECT为空rn本来的目的是想在弹出的对话框中画图,发现刷新后没有图形后在OnDraw()中加入了重绘图形的代码,但是发现在刷新的时候还是没有图形,个人认为可能是因为从GetClientRect得到的RECT结构为空(RECT用来装载对话框的客户区,即其所在区域),但不知应该如何修改。请大虾们看看应该如何修改,或者如果原因不在于RECT为空,应该如何修改rn代码如下:rnvoid CMyView::OnDraw(CDC* pDC)rnrn CMyDoc* pDoc = GetDocument();rn ASSERT_VALID(pDoc);rn // TODO: add draw code for native data herern CImage &img=pDoc->m_image ;rn CRect r;rn r.left =0;r.top =0;rn r.right =img.Width();rn r.bottom =img.Height();rn img.DrawToHDC(pDC->GetSafeHdc (),r);rn extern color;rn if(color!=0) rn rn rn rn //if(viewdialog!=NULL)rn CRect picrect;rn this->GetClientRect(&picrect);rn PAINTSTRUCT pts;rn CDC * cdc=BeginPaint(&pts);rn HDC hdc=cdc->GetSafeHdc ();rn HBRUSH hbrush;rn HPEN hpen;rn hpen=(HPEN)GetStockObject(BLACK_PEN);rn hbrush=(HBRUSH)GetStockObject(BLACK_BRUSH);rn SelectObject(hdc,hpen);rn SelectObject(hdc,hbrush);rn Rectangle(hdc,picrect.left ,picrect.top ,picrect.right,picrect.bottom);rn ..............(以下代码省略)rn注:color是用来判断对话框是否存在的标志,从目前的调试看来它是有效的,即没有显示图形不是color的原因rn请大虾指教,多谢!
dwr 返回的list为空
我用dwr进行开发时,后台测试list中有数据且正确,但是传递到页面上时,只能测试到list的长度是正确的,但是list中的对象都是空。我不知道是怎么回事,我写dwr的顺序是这样的:rn (1)写后台的处理类rn [code=Java]rn public List getAlarmList()rn List alarmList=new ArrayList();rn alarmList=ad.findAll();rn return alarmList;rn rn [/code]rn (2)web.xml中配置dwr的servletrn [code=XML]rn rn dwr-invokerrn rn org.directwebremoting.servlet.DwrServletrn rn rn debugrn truern rn rn logLevelrn ERRORrn rn rn activeReverseAjaxEnabledrn truern rn rn rn initApplicationScopeCreatorsAtStartuprn rn truern rn rn maxWaitAfterWritern 500rn rn 1rn rn rn rn dwr-invokerrn /dwr/*rn rn[/code]rn (3)配置dwr.xml,rn [code=XML]rn rn rnrn rn rn rn rn rn rnrn[/code]rn (4)前台页面中引入dwr的js,并且使用rn [code=JScript]rn function showAlarmOnScrollBar()rn info. getAlarmList(rn function(alarmList)rn alert(alarmList);rn alert(alarmList.length);rn alert(alarmList[0].title);rn rn );rn rnrn[/code]rnalarmArray的展示值为""""""""";rn长度显示为8rn最后一个alert(),提示alarmList[0]为null,rn我现在没有分了,所以给不了大家太多分,请多帮忙
Unity 单例返回为空
单例代码如下,在awake里面添加了debug,在创建单例之后显示rn[img=https://img-bbs.csdn.net/upload/201801/04/1515066201_680799.png][/img]rnrn运行后报错:错误如下:rn[img=https://img-bbs.csdn.net/upload/201801/04/1515066227_689122.png][/img]rndebug信息在报错之后,难道是awake在Instance之后执行?rnrn报错位置如下:rn[img=https://img-bbs.csdn.net/upload/201801/04/1515066150_682788.png][/img]rnrn没搞懂
upload.parseRequest(request)返回为空
[code=text]rnrnrn excel导入到数据库rnrnrn excel导入到数据库:rn 选择一个文件进行上传:rn rn rn rn rn <%rn if (request.getParameter("action") != null) rn if (request.getParameter("action").equals("submit")) rn int maxFileSize = 5000 * 1024;rn int maxMemSize = 5000 * 1024;rn ServletContext context = pageContext.getServletContext();rn String filePath = context.getInitParameter("file-upload");rn String contentType = request.getContentType();rn if ((contentType.indexOf("multipart/form-data") >= 0)) rn DiskFileItemFactory factory = new DiskFileItemFactory();rn factory.setSizeThreshold(maxMemSize);rn factory.setRepository(new File("c:\\temp"));rn ServletFileUpload upload = new ServletFileUpload(rn factory);rn upload.setSizeMax(maxFileSize);rn List fileItems = upload.parseRequest(request);rn rn rn rn %>rnrnrn[/code]rn就是到这里fileItems就为空了,有大神帮忙看下吗
GetSelText()总是返回为空?
我重载了一个CRichEditCtrl类CMenuEdit,Dialog里有个编辑框与之关联rnCMenuEdit m_edit; //成员变量rnrn我是想要在回车的时候得到这次输入的字符串rnnLen = m_edit.GetWindowTextLength();rnm_edit.SetSel(nEndChar, nLen); //nEndChar保存的是上次光标位置rnm_eidt.GetSelText(m_szBuf);rnrn为什么我这里m_szBuf总是为空?rnrn用m_edit.GetLine(1,m_szBuf)也总是为空?rn
requests返回为空的问题
学生党,弄着玩rn爬取微舆情rn头文件,data都已更改,allow_redirects设置为False,但requests返回的值为空rn代码如下rnrn```rnimport jsonrnimport requestsrnimport datetimernimport urllib3rnfrom urllib3.exceptions import InsecureRequestWarningrnurllib3.disable_warnings(InsecureRequestWarning)rnsess = requests.session()rnrndef run(keyword):rn headers = rn 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',rn 'Host': 'www.wrd.cn',rn 'Origin': 'http://www.wrd.cn',rn 'Referer': 'http://www.wrd.cn/goSearch.shtml',rn 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',rn 'X-Requested-With': 'XMLHttpRequest',rn rnrn endTime = datetime.datetime.now()rn startTime = endTime + datetime.timedelta(days=-1)rn data = rn 'title': '%s' % (keyword),rn 'keyword': '%s' % (keyword),rn 'filterKeyword': '',rn 'categoryId': '',rn 'categoryType': '',rn 'secondCategory': '',rn 'date': '24',rn 'categoryLevel': '',rn 'startTime' : startTime.strftime("%Y-%m-%d %H:%M:%S"),rn 'endTime':endTime.strftime("%Y-%m-%d %H:%M:%S"),rn 'secondClassifyName': '',rn 'threeClassifyName':'',rn 'isAll':'',rn 'shareCode':''rn rnrn url = 'http://www.wrd.cn/view/openTools/goHotWorthOTChart.action'rn res = sess.post(headers=headers, data=data, url=url,allow_redirects=False)rn print(res.text)rnrnrnrun('千佛山')rnrnrnrnrn```
AJAX responseXML返回为空
初学AJAX,想实现JS接收Struts1.2 Action中动态生成的XML文档,可是总为空,不知道怎么解决啊rnrnXMLHttpRequest.responseXML 空rnXMLHttpRequest.responseText 很好的获取服务端返回的XML数据rnrn很多资料都说设置 response.setContentType("text/xml");rnrn我都设置了,可是rnXMLHttpRequest.responseXML还是为空,不知道如何解决rnrnrnAction代码:rnrn[code=Java]rnpublic ActionForward responseAjaxRequest(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exceptionrn rnresponse.setContentType("text/xml;charset=gb2312");rnStringBuffer stringBuffer = new StringBuffer();rnrn stringBuffer.append("");rn stringBuffer.append("\n");rn stringBuffer.append("");rn stringBuffer.append("\n");rn stringBuffer.append("Struts开发基础");rn stringBuffer.append("\n");rn stringBuffer.append("Hibernate开发基础");rn stringBuffer.append("\n");rn stringBuffer.append("Spring开发基础");rn stringBuffer.append("\n");rn stringBuffer.append("");rn rn String xmlFile = stringBuffer.toString();rn PrintWriter printWriter = response.getWriter();rn printWriter.write(xmlFile);rn printWriter.flush();rn printWriter.close();rn rn return null;rn rn[/code]rnrnrnrn
返回数据为空的判断
用sql命令查询一条数据,access中没有满足符合条件的数据,请问用vbscript怎么判断这样的情况?
OpenFire所有在线用户
代码里做了逻辑处理,会随机只返回3个,改下就可以了 访问路径 127.0.0.1:8080/plugins/onlineuser/getallusers
spring调用properties为空?
![图片说明](https://img-ask.csdn.net/upload/201810/25/1540455928_932920.png) ![图片说明](https://img-ask.csdn.net/upload/201810/25/1540455864_716096.png) rn![图片说明](https://img-ask.csdn.net/upload/201810/25/1540455873_593631.png)rn 如题,我有两个配置文件,db.properties和config.properties,db.properties没问题,唯有config.properties读取有问题。rn 请教:如何通过@value方式读取这个properties文件,代码如图。
sessionFactory为空之spring依赖注入
spring整合hibernate出现的sessionFactory为null
查询判断某个字段是否为空 不为空返回1 为空返回0
DECODE(Z.ZDDM,NULL,0,1 )
js判断值是否为空,null,undefined,为空返回true,不为空返回true
function isEmpty(data){ var dataType = typeof(data);//typeof 返回的是字符串,有六种可能:”number”、”string”、”boolean”、”object”、”function”、”undefined” ; switch(dataType){ case “number”://数字 ...
为什么获取的指针为空?
在rnrnpacket_handler被我定义成静态函数rnrnvoid CNMCView::packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)rnrn //添加获取当前视图指针rn CMainFrame *pMF=(CMainFrame *)AfxGetMainWnd(); rn CNMCView *pView=(CNMCView *)pMF->GetActiveView();//到这里为什么获取到的pview指针为空啊?rn pView->m_ncmlistctrl.InsertItem(0,"192.168.1.1");rnrn
IHTMLElement->get_innerHTML获取为空
有个Img节点,get_href可以获取到图片地址,我想获取整个节点的HTML内容,获取的竟然是空的。rn有什么好的方法获取HTML吗?rnImg使用original属性延迟加载图片,我想获得original指定的图片地址,有什么好的方法吗?
asp.net 实时更新在线用户,获取在线用户
进销存系统,实时更新在线用户,获取用户登录的ip,可以注销用户
findFragmentById 获取 Fragment为空!!!
rn为什么取到的fragment都是null啊?界面上都显示了rnrn[code=java]protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_main);rn rn if (savedInstanceState == null) rn Log.i("MyFragment", "savedInstanceState == null");rn Toast.makeText(MainActivity.this, "onCreate", Toast.LENGTH_SHORT).show(); rn// getFragmentManager().beginTransaction()rn// .add(R.id.main_layout, new PlaceholderFragment()).commit();rn// getFragmentManager().beginTransaction()rn// .add(R.id.main_layout, new PlaceholderFragmentRight()).commit();rn Display display = this.getWindowManager().getDefaultDisplay();rn if(display.getWidth()>display.getHeight())rn rn this.getFragmentManager().beginTransaction().replace(R.id.layout_main, new PlaceholderFragmentRight()).commit();rn else rn this.getFragmentManager().beginTransaction().replace(R.id.layout_main, new PlaceholderFragment()).commit();rn rn rn rn rn rn rn[/code]rnrnonConfigurationChanged里rn[code=java]FragmentTransaction ft = this.getFragmentManager().beginTransaction();rn Fragment cur_Fragment = this.getFragmentManager().findFragmentById(R.id.fragment);rn if(cur_Fragment != null)rn Toast.makeText(MainActivity.this, cur_Fragment.toString(), Toast.LENGTH_SHORT).show(); rn ft.remove(cur_Fragment);rn else rn Toast.makeText(MainActivity.this, "cur_Fragment is null", Toast.LENGTH_SHORT).show(); rn rn ft.add(R.id.fragment, fragmeng_right);rn ft.addToBackStack(null);rn ft.commit();[/code]
User.Identity.Name获取为空解决方法
1.在webconfig中的节点下配置2.在iis中配置,以6.1为例,选中网站-双击身份验证-点击windows身份验证-点击启用3.禁用forms身份验证
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池