1
2
3
|
User user=getModel(User.
class
);
user.set(
"id"
, UUID.randomUUID().toString());
user.save();
|
1
2
3
4
|
String name=getPara(
"user.name"
);
String password=getPara(
"user.password"
);
List<User> l=User.dao.find(
"select * from user where name='"
+name+
"' and password='"
+password+
"'"
);
|
三、保存和移除用户信息到session中php
1
2
3
4
|
//保存session
getSession().setAttribute(
"username"
, name);
//移除session
getSession().removeAttribute(
"username"
);
|
1
2
3
4
5
6
7
8
|
<
c:if
test
=
"${sessionScope.username!=null}"
>
<
a
href
=
'/user/userInfo.jsp'
>欢迎 ${sessionScope.username}</
a
>
<
span
></
span
><
a
href
=
'/user/logout'
>注销</
a
>
</
c:if
>
<
c:if
test
=
"${sessionScope.username==null}"
>
<
a
href
=
'/user/login.jsp'
>登陆</
a
>
<
span
></
span
><
a
href
=
'/user/register.jsp'
>注册</
a
>
</
c:if
>
|
jstl只有if没有else,因此用了两个if。分支多的时候能够用下面的标签html
1
2
3
4
5
6
7
8
9
10
11
|
<
c:choose
>
<
c:when
test
=
"${condition1}"
>
condition1为true
</
c:when
>
<
c:when
test
=
"${ condition2}"
>
condition2为true
</
c:when
>
<
c:otherwise
>
condition1和condition2都为false
</
c:otherwise
>
</
c:choose
>
|
五、servlet api
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/ 前端
![]() |
1楼:Smile月光 Android 发表于 2013-03-12 06:59 回复此评论
主要的呢。。。。
|
![]() |
2楼:土龙 发表于 2013-03-12 09:25 回复此评论
引用来自“panfanglin”的评论主要的呢。。。。java |
![]() |
3楼:greatddk 发表于 2013-06-14 14:59 回复此评论
'or 'a'='a,登陆成功!
|
![]() |
4楼:土龙 发表于 2013-06-14 15:04 回复此评论
引用来自“greatddk”的评论'or 'a'='a,登陆成功!mysql |