您好,登录后才能下订单哦!
1.${SESSION_USER_V2}
        会从大到小查找作用域中的attribute
          PageContext                          PageScope
          servletRequest                       RequestScope
          httpSession                         SessionScope
          Application/servletContext        ApplicationScope   
          
          
2.${param.name}
实际上是相当于request.getParameter("name")方法
3.空连接
href="#"方法:
其实也是空连接的意思,但是点击之后会自动跳转到页面的最上面,因为用了这个方法就相当于点击了一个锚记,但是这个锚记又没写ID,所以就默认跳转到页面顶部。
href="javascript:void(0);"方法:
void是一个操作符,这个操作符指定要计算一个表达式但是不返回值。如果在void中写入0(void(0)),则什么也不执行,从而也就形成了一个空链接。
#与javascript:void(0)的区别:
所以,#与javascript:void(0)的区别也很明显,#方法会跳转到页面的顶部,并且在页面URL后面会出现#,而javascript:void(0)方法不会,所以如果是空连接的话,还是推荐javascript:void(0)。 
4.添加删除样式
$(function(){
    $("#myArticle").click(function(){
        $("#allArticle").removeClass("current");
        $("#myArticle").addClass("current");//最好不要用Attr()和removeAttr(),因为css样式会继承
    })    
    $("#allArticle").click(function(){
        $("#myArticle").removeClass("current");
        $("#allArticle").addClass("current");//
    })    
    
})
5.SpringMVC获取session
直接在方法上使用 HttpSession即可注入
 或者注入HttpServletRequest--->再获取Session
6.拦截器配置
applicationContext.xml
 <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/comment*"/>
            <mvc:mapping path="/article/add"/>
           <mvc:mapping path="/article/myArticle"/>
            <bean class="com.dooioo.samples.blog.inteceptor.LoginInteceptor" />
        </mvc:interceptor>
    </mvc:interceptors>
    
7. context root设置问题
比如我们的项目名称是myApp(即myApp文件夹下有WEB-INFO文件夹),发布在本机80端口,且context-root设置为myApp,
则访问默认欢迎页面时的url是:http://localhost:80/myApp。如果context-root设置成/,则url会变成:http://localhost:80/
1.在新建web项目时,仔细观察会有输入框提示输入context-root,如果希望url是后者的样子,则context-root框中只输入"/"即可,否则输入你想要的目录名称;
2.如果您使用eclipse开发,则在项目上右击,然后选择属性,再选择Web Project Settings,然后修改
context-root内容;若您使用myEclipse开发,则右击项目-->“Properties”-->“MyEclipse”-->“Web”,看到了吧“Context Root”选项卡里的“Web Context-root”,修改之;
8.修改eclipse虚拟机内存
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms256m
-Xmx1024m  堆内存
-XX:PermSize=512M    非堆内存
-XX:MaxPermSize=1024M 
9.Target runtime Apache Tomcat v6.0 is not defined.
项目文件夹下
.settings\org.eclipse.wst.common.project.facet.core.xml文件中
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <runtime name="Apache Tomcat v6.0"/>
  <fixed facet="java"/>
  <fixed facet="jst.web"/>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.6"/>
  <installed facet="jst.web" version="2.5"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
删除掉 <runtime name="Apache Tomcat v6.0"/>
10. Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

11. ibatis中sql语句中#与$的区别
1.#是把传入的数据当作字符串,如#user_id_list#传入的是1,2,则sql语句生成是这样,in ('1,2') ,当然不可以
2.$传入的数据直接生成在sql里,如#user_id_list#传入的是1,2,则sql语句生成是这样,in(1,2) 这就对了. 
3.#方式能够很大程度防止sql注入
4.$方式无法方式sql注入 
5.$方式一般用于传入数据库对象,例如传入表名
直观的说 
#str# 出来的效果是  'str' 
$str$ 出来的效果是  str 
另外  ##只能用在特定的几个地方 $$可以用在任何地方  比如 order by $str$ 
你甚至可以直接写  $str$  把 order by 这个字串放在str里传进来 
12. model.addAttribute(article)
默认key为article的类型
13.springmvc的controller默认是单例的
可以加上@Scope("prototype")变为多实例的
14.<jsp:param>标签
<jsp:param>操作被用于以"名-值"对的形式为其他标签提供附加信息。
它可以和<jsp:include>,<jsp:forward>,<jsp:plugin>一起使用。
例1:实现 includeaction.jsp中展示come.jsp页面,值由主页面传入。
includeaction.jsp代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Include</title> </head> <body> <%double i = Math.random();%> <jsp:include page="come.jsp">//加载come.jsp <jsp:param name="number" value="<%=i%>" />//传递参数 </jsp:include> </body> </html>
在come.jsp代码
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
    <title>come</title>
</head>
<body bgcolor=cyan>
  <Font Size=3>
  <%//获得includeAction.jsp传来的值:
    String str = request.getParameter("number");
    double n = Double.parseDouble(str);
   %>
    The value form includeAction is:<br> <%=n%>
</Font>
</body>
</html>15. return false
取消元素的默认行为
16.Ibatis中SqlMapClientTemplate和SqlMapClient的区别 
SqlMapClientTemplate是org.springframework.orm.ibatis下的
而SqlMapClient是ibatis的
SqlMapClientTemplate是SqlMapClient的封装类. 
SqlMapClient中包含着session的管理. 
SqlMapClientTemplate用于session的封装,以及异常的捕捉. 
所以按照以上的推断来说.应该尽量使用SqlMapClientTemplate. 
保证session以及Exception的正常以及统一.
参考文章:
http://blog.csdn.net/wxwzy738/article/details/16953609
17.there is no statement named xxx in this SqlMap 
sqlmap文件定义了namespace属性,就需要这样写:(你的namespace).(定义的statement的id),如果把namespace属性漏了,就被报此异常
<sqlMap namespace="Category"> <typeAlias alias="category" type="com.dooioo.samples.blog.model.Category"/> <select id="query" resultClass="category"> select * from category where status != -1 </select> <insert id="insert" parameterClass="category"> insert into category(name) values (#name#) </insert> <update id="delete" parameterClass="int" > update category set status=-1 where id=#id# </update> <select id="queryForPaginate2" parameterClass="category" resultClass="category"> mst_sp_pageshowex4 '$columns$ ','$table$','$where$','$orderBy$',$pageSize$,$pageNo$ </select> <select id="count2" parameterClass="category" resultClass="integer"> sp_pagecount '$table$','$where$' </select> </sqlMap>
18. ibatis upadte delete insert 返回作用的行数
com.dooioo.web.converter.DyMappingJacksonHttpMessageConverter
19.HTTP400\HTTP500
HTTP400    错误的请求
HTTP500   内部服务器错误!
404请求 404状态码是一种http状态码,其意思是: 所请求的页面不存在或已被删除!
通俗的讲就是当用户输入了错误的链接时,返回的页面。
20.@ModelAttribute Article article, BindingResult result
(BindingResult result必须紧跟在@ModelAttribute后面)
21 @ModelAttribute和@Valid区别
@ModelAttribute is used to map/bind a a method parameter or method return type to a named model attribute. See @ModelAttributes JavaDoc. This is a Spring annotation.
@Valid is an annotation that marks an object for JSR-303 bean validation. See @Valids JavaDoc. It is part of JavaEE 6, but I think Hibernate has an earlier implementation that most people use instead.
The advantage of using @ModelAttribute is that you can map a form's inputs to a bean. The advantage of @Valid is that you can utilize JSR-303 bean validation to ensure that the bean that is made is validated against some set of rules.
Yes you can use @ModelAttribute and @Valid together.
JSR 303 – Bean Validation 是一个数据验证的规范
22.sqlserve服务器密码登录
http://blog.csdn.net/jufeng9318/article/details/8203780
 
23.EL表达式加三元表达式 
 <input id ="keyword" type="text" name="keyword"  value="${ keyword !=null ? keyword : '输入问题关键词,如:产品线、技术分享等…' }" >
 
24. web.xml启动顺序
 1.context-param 
 2.listener
 3.filter
 4.servlet
          
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。