12 2013 档案
摘要:判断字符串的问题: 1、判断单个字符: 这样是从session中取出username的值,并且判断其是否为c,但是这样判断是不正确的,这样判断的话,根本判断不出来,要改成下面这样: 这样判断才能正确判断,至于原因我也不知道,在网上看到struts2中可能它判断的是char类型。 2、判断字符串: 这样写的就是判断username是不是milo,是String的判断,这个是不用加toString()的。 3、判断数值: 这样写的就是判断username是不是0,是int的判断。 B:判断为空的问题: struts2中的判空似乎只能这么写 判断非空可以这样写: ...
阅读全文
摘要:1. 读取并解析XML文档: SAXReader reader = new SAXReader(); Document document = reader.read(new File(fileName)); reader的read方法是重载的,可以从InputStream, File, Url等多种不同的源来读取。得到的Document对象就带表了整个XML。 读取的字符编码是按照XML文件头定义的编码来转换。如果遇到乱码问题,注意要把各处的编码名称保持一致即可。 2. 取得Root节点 Element root=document.getRootElement(); root元素是xml文档的
阅读全文
摘要:简单效果图1,创建一个项目myblog 可参考这里myblog/ manage.py myblog/ __init__.py settings.py urls.py wsgi.py2,创建blogs app 可参考这里myblog/myblog/blogs/ __init__.py models.py tests.py views.py编写models.py#vim: set fileencoding=utf-8:from django.db import models# Create your models here.cla...
阅读全文
浙公网安备 33010602011771号