Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Design Pattern & UML  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 3 [Re:prettyxx]
prettyxx





发贴: 75
积分: 42
于 2003-12-16 13:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
自定义标签类GetRequestParameterTag.java
package tags;

import javax.servlet.ServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class GetRequestParameterTag extends TagSupport {
private String property;

public void setProperty(String property){
this.property = property;
}
public int doStartTag() throws JspException {
ServletRequest reg = pageContext.getRequest();
String value = reg.getParameter(property);

try{
pageContext.getOut().print(value == null ? "":value);
}catch(java.io.IOException e){
throw new JspException(e.getMessage());
}
return SKIP_BODY;
}
}

登陆成功welcome.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Welcome Page</title>
</head>
<body>
<jsp:userBean id="user" scope="session" class="beans.User"/>
<!--也可以
<%
User user = (User)session.getAttribute("user");
%>
-->
欢迎你:<font color=red><%=user.getUserName()%></font>
</body>
</html>

登陆失败loginFailed.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Login Failed</title>
</head>

<body>
<font color="#993366">请输入用户名和密码,或者创建一个新用户!</font>
<%@ include file="/login_form.jsp" %>
<hr>
<a href="<%=response.encodeURL("newAccount.jsp")%>">创建一个新用户 </a>
</body>
</html>



我的Blog:阿泠的自省札记
========心有多大,舞台就有多大========

话题树型展开
人气 标题 作者 字数 发贴时间
7466 [转帖]用MVC架构简单的注册、登录例子 prettyxx 2237 2003-12-16 13:28
6277 2 prettyxx 3282 2003-12-16 13:29
6429 3 prettyxx 1468 2003-12-16 13:30
6315 4 prettyxx 1756 2003-12-16 13:31
6420 Re:[转帖]用MVC架构简单的注册、登录例子 ccw 4 2004-01-04 09:52

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923