文件管理问题记录点
来源:互联网 发布:电脑网络连接在哪里找 编辑:程序博客网 时间:2024/04/26 04:03
文件类型(后缀名)控制
文件重命名,防止重名,UUID.randomUUID().toString()
文件路径,防止单个目录下文件过多
int hashcode = filename.hashCode();
int dir1 = hashcode&0xf; //0--15
int dir2 = (hashcode&0xf0)>>4; //0-15
字段名 含义 数据类型 备注
id_bf_file 主键 varchar(32) uuid
storage_path 存储路径 http://domain:port/context/20160909/1/1/234xfgd3wxvdvds90sdfmsdds.txt
show_path 展示路径 /分类1/分类2/分类3/模块工程文件.txt
suffix 后缀名
file_name 文件名
revision 版本
origin_file 原始文件id
memo 备注
owner_code 上传人
owner_name
download_count 下载次数
BaseAction
public HttpServletRequest getRequest();
public HttpServletResponse getResponse();
public HttpSession getSession();
public ServletContext getServletContext();
- <!-- 将多个配置文件读取到容器中,交给Spring管理 -->
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <!-- 这里支持多种寻址方式:classpath和file -->
- <value>classpath:/opt/demo/config/demo-db.properties</value>
- <!-- 推荐使用file的方式引入,这样可以将配置和代码分离 -->
- <value>file:/opt/demo/config/demo-mq.properties</value>
- <value>file:/opt/demo/config/demo-remote.properties</value>
- </list>
- </property>
- </bean>
struts2.5通配符问题
struts.enable.DynamicMethodInvocation = true
package中增加<global-allowed-methods>regex:.*</global-allowed-methods>struts2全局异常控制
自定义异常、struts拦截器拦截特定异常并处理(封装异常信息)、重写jq的ajax,统一处理error
大文件上传
http://www.cnblogs.com/xproer/archive/2012/05/29/2523757.html
http://www.mamicode.com/info-detail-1387570.html
http://www.sxrczx.com/pages/blog.kazaff.me/uxgb1423648892626.html
spring多个配置文件引入
// <beans></beans>标记之间引入其他applicationContext.xml
<beans>
<import resource="applicationContext-cache.xml"/>
</beans>
hibernate 外键关联
<many-to-one name="role" class="com.Role" update="false" insert="false" fetch="select">
<column name="id_bf_role" length="50" />
</many-to-one>
未登录访问跳转
使用struts2 拦截器public class LoginValidate extends AbstractInterceptor
- @Override
- public String intercept(ActionInvocation invocation) throws Exception {
- String namespace = invocation.getProxy().getNamespace();
- String actionName = invocation.getProxy().getActionName();
- if(("/".equals(namespace) && "toLogin".equals(actionName)) ||
- ("/".equals(namespace) && "login".equals(actionName))){
- return invocation.invoke();
- } else {
- Map<String, Object> session = ActionContext.getContext().getSession();
- Employee e = (Employee) session.get("cur_user");
- if(e == null) {
- return "login";
- } else {
- return invocation.invoke();
- }
- }
- }
String action = invocation.getInvocationContext().getName();
- <package name="mydefault" extends="struts-default" abstract="true">
- <!-- 添加拦截器 -->
- <interceptors>
- <!-- 添加登陆拦截器 -->
- <interceptor name="loginValidate" class="com.kaishengit.intercepter.LoginValidate"/>
- <!-- 新建一个站,把登陆拦截器和默认的站放进去 -->
- <interceptor-stack name="mystack">
- <interceptor-ref name="defaultStack"/>
- <interceptor-ref name="loginValidate"/>
- </interceptor-stack>
- </interceptors>
- <!-- 修改默认拦截器 -->
- <default-interceptor-ref name="mystack"/>
- <!-- 将result设置为全局的,这样就不用在每一个package里面都添加拦截器了 -->
- <global-results>
- <result name="login" type="redirectAction">
- <param name="actionName">toLogin</param>
- <param name="namespace">/</param>
- <param name="code">1002</param>
- </result>
- </global-results>
- </package>
机构信息表,机构关联表
关联表记录父子关系,包括跨级,空间换时间方便查询。
中间表与hibernate配置
/** * 学生表 */public class Student { private Long id; private String name; //与学生课程关联表建立一对多关系 private Set<StudentCourseRelation> scr = new HashSet<StudentCourseRelation>();
<hibernate-mapping> <class name="com.study.hibernate.domain.Student" table="t_student" catalog="db_hibernate"> <id name="id" column="id" type="java.lang.Long"> <generator class="native"></generator> </id> <property name="name" column="name" type="java.lang.String"></property> <set name="scr" cascade="all"> <key column="student_id"/> <one-to-many class="com.study.hibernate.domain.StudentCourseRelation"/> </set> </class> </hibernate-mapping>
/** * 课程 */public class Course { private Long id; private String name; //与学生课程关联表建立一对多关系 private Set<StudentCourseRelation> scr = new HashSet<StudentCourseRelation>();
<hibernate-mapping> <class name="com.study.hibernate.domain.Course" table="t_course" catalog="db_hibernate"> <id name="id" column="id" type="java.lang.Long"> <generator class="native"></generator> </id> <property name="name" column="name" type="java.lang.String"></property> <set name="scr" cascade="all"> <key column="course_id"/> <one-to-many class="com.study.hibernate.domain.StudentCourseRelation"/> </set> </class> </hibernate-mapping>
/** * 学生课程关联表 */public class StudentCourseRelation { private Long id; private Long sort; private Student students; private Course courses;
<hibernate-mapping> <class name="com.study.hibernate.domain.StudentCourseRelation" table="t_student_course_relation" catalog="db_hibernate"> <id name="id" column="id" type="java.lang.Long"> <generator class="native"></generator> </id> <property name="sort" column="sort" type="java.lang.Long"></property> <many-to-one name="students" class="com.study.hibernate.domain.Student" column="student_id"></many-to-one> <many-to-one name="courses" class="com.study.hibernate.domain.Course" column="course_id"></many-to-one> </class> </hibernate-mapping>
hibernate 表关联配置
多对一,many-to-one,在多方(用户)定义单方(机构)的引用
一对多,one-to-many,在单方(机构)定义多方集合(所有用户)的引用
lazy="false"表示是延迟加载,当为true时,启动延迟加载,如两个关联a,b不延迟加载时可能加载a时候,也把b加载了,但你可能没用b,只用a了,这就造成了浪费,延迟加载时表示用到b时才加载。
inverse="true"默认是false,将控制权翻转,用在一对多中表示交给多方。在一对多关联中,在多的一方设置inverse="true",有助于性能的改善。通过上述分析可以发现少了update语句。
不需要查询的一方不用关联,即用户-角色中,一般不会根据角色查用户,所以角色中不增加关联配置
结论:
user属于单方,对应多个userrole,配置one-to-many,inverse="true",
role正常
userrole属于多方,配置两个many-to-one,对应user和role两个对象,
使用样例1:新增user
user = new user();
ur1 = new userrole(); ur1.set
ur2 = new userrole(); ur2.set
new list;
list.addur1 addur2
user.addlist
save user
样例2
登出
request.getSession().invalidate();
response.sendRedirect(LOGIN_URL);
全局jq的ajax封装
http://www.myexception.cn/ajax/1986995.html
http://fengfan876.iteye.com/blog/1541532
http://www.cnblogs.com/gongchenglion/p/5175727.html
日志aop
http://www.cnblogs.com/jyh317/p/3875546.html
从session中获取操作人员 https://my.oschina.net/kkrgwbj/blog/679128
拦截器也可实现 http://blog.csdn.net/techbirds_bao/article/details/8251394 (貌似不太好,aop应该正统一些。。。)
AOP是很多直觉难以理解的术语的根源。幸运的是,你只要理解三个概念,就可以编写AOP模块。这三个概念是:advice,pointcut和advisor。<strong>advice</strong>是你想向别的程序内部不同的地方注入的代码。<strong>pointcut</strong>定义了需要注入advice的位置,通常是某个特定的类的一个public方法。<strong>advisor</strong>是pointcut和advice的装配器,是将advice注入主程序中预定义位置的代码。
http://blog.csdn.net/topwqp/article/details/8695180
http://blog.csdn.net/lovemenghaibin/article/details/51581695
http://743389831.iteye.com/blog/1755631
https://my.oschina.net/itblog/blog/211693
http://blog.csdn.net/ab7253957/article/details/50904185
http://itindex.net/detail/47777-spring-mvc-spring
http://m635674608.iteye.com/blog/1678995?utm_source=jiancool
http://www.zuidaima.com/question/2186217251916800.htm
http://www.92to.com/bangong/2016/11-05/12533115.html
angularjs与springmvc
http://iceworldvip.blog.51cto.com/5438460/1294155/
单元测试
https://my.oschina.net/asd1614/blog/530528
hibernate opensession getcurrentsession区别
事务由hibernate管理?还是spring管理?spring管理的话,注解/aop选择问题
http://blog.csdn.net/qq931399960/article/details/45222927
http://blog.csdn.net/pwq296306654/article/details/50254787
springmvc date类型转换
http://blog.csdn.net/chenleixing/article/details/45190371
http://wenku.baidu.com/link?url=mhCSQ7BYD3fDSgb9m915DLMG5ktVjnahv5D1NNEP0kj8mwA6KfiAjQRFdo2MbGk5J2gABQF5xecXKiiw3pEix08zIwNxE5oSs9ck8SjVfQi
传递list对象
ui grid
https://my.oschina.net/gmd/blog/670895
angular + springmvc 传参问题
http://www.myexception.cn/operating-system/2048416.html
myelipse+maven
下载maven:http://maven.apache.org/download.cgi,解压,配置M2_HOME环境变量,并在PATH中加入%M2_HOME%\bin,cmd中mvn -version验证。
修改解压目录下,conf文件夹下的settings.xml文件,设置本地仓库路径,例如<localRepository>E:/mvnRespo</localRepository>(默认为.m2文件夹下)
Eclipse的菜单栏点击Windows-> Preferences -> Maven ->Installations,将解压目录Add进来。UserSettings中,将解压目录下conf文件夹下的settings.xml文件引入进来。
pom.xml
远程仓库,顺序(本地库-中央库-远程库)
<repositories>
<repository>
<id>java.net</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
</repositories>
- 文件管理问题记录点
- 问题点管理表
- Android开发问题点记录
- _记录点 交易管理完成
- linux 2.6.36.2移植问题点记录
- SSIS使用中的问题点记录
- Android源码编译问题点记录
- 运行Fresco Demo问题点记录
- Android闹钟开发问题点记录
- IOS开发学习过程问题点记录
- 4.4 文件管理疑难点 1-2
- 文档管理app端需求实现方案关键点记录
- Linux学习记录--文件与目录管理
- 写Makefile文件问题记录
- c#文件乱码问题记录
- 项目管理系统问题记录(1)
- HBase集群运维管理 问题记录
- supervisor管理进程停止异常问题记录
- Android中的SystemClock类
- JAVA 堆和栈
- Struts2-字段优先校验
- mysql插入中文乱码,我犯了一个很弱智的错误
- does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare
- 文件管理问题记录点
- 文章标题
- iOS 点击tabBar弹出登录窗口
- android屏幕适配
- swift--Swift 3.0实战:实现Dispatch once扩展
- js拖拽思想
- 2016/10/8 1001. 舞蹈室安排
- nginx+tomcat负载均衡和session复制
- Java中Timer定时器的使用