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 |