Light  Rain serena

«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告

期待

超级好友 Rachel


我的分类(专题)

首页(262)
知识积累(40)
乐瑟温柔(108)
经验杂谈(20)
良辰吉日(2)
杂七杂八(57)
天景共赏(10)
感触文字(23)


最新日志
sunshine girl
过云雨
summer whisper
边走边唱
岛歌
不必在乎我是谁
如果有来生
Fing Fing 下
大明宫
我没有魅力

最新回复
回复:边界类、控制类、实体类
回复:边界类、控制类、实体类
回复:边界类、控制类、实体类
回复:《极地特快》插曲《When Chr
回复:边界类、控制类、实体类
回复:不必在乎我是谁
回复:边界类、控制类、实体类
回复:如果有来生
回复:Fing Fing 下
回复:我没有魅力

留言板
签写新留言

老大&老师,我想你.....
好文好多阿
886电台 好听
cai
您的子域名已开通
hi
祝福
祝福

你好

统计
blog名称:小雨
日志总数:262
评论数量:1273
留言数量:15
访问次数:4667410
建立时间:2005年1月8日

链接

有事?
音乐,永不厌倦
宁静的心情驿站
我的声音
TIPOblog
tipo bbs
appleVB
网页设计
英语学习2
英语学习3
FLASH
网络书籍
网络电台



我的博客朋友
最有技术的blog
xenium
花差花差
瓜少
span
a lai
琦少
陈少
v
阿当
http://www.ypb.cc/
痞子若鱼
另一个同行
年轻人bcims

 




W3CHINA Blog首页    管理页面    写新日志    退出

[知识积累]我的第一个struts
小雨 发表于 2007/12/2 12:14:20

环境 tomcat5.5 ,jdk1.5 ,struts1.3.8 1 index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <!-- :TODO: It would be interesting to try this with frames and modules --><html><head> <title>RegUser</title></head> <body bgcolor="white"> <html:form action="/RegUser" focus="logname"><table border="0" width="100%"> <tr><th align="right">Logname:</th> <td align="left"><html:text property="logName" size="20" maxlength="20"/></td> </tr><tr> <th align="right">Password: </th> <td align="left"><html:password property="passWord" size="20" maxlength="20"/> </td> </tr> <tr> <th align="right"> E-mail: </th> <td align="left"> <html:password property="email" size="30" maxlength="50"/> </td> </tr> <tr> <td align="right"> <html:submit property="submit" value="Submit"/> </td> <td align="left"><html:reset/> </td> </tr> </table> </html:form> </body></html> 2 RegUserAction package org.cjea.Struts.example; import javax.servlet.http.*; import org.apache.struts.action.*; public final class RegUserAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm actionform, HttpServletRequest req, HttpServletResponse res) { RegUserForm form = (RegUserForm)actionform; String title = form.getLogName();String password = form.getPassWord();String email = form.getEmail(); if(title.equals("email"))return (mapping.findForward("success"));elsereturn (mapping.findForward("fails"));} } 3 RegUserForm package org.cjea.Struts.example;import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public final class RegUserForm extends ActionForm{ private String logname; private String password; private String email; public RegUserForm(){ logname = null; password = null; email = null; } public String getLogName() { return this.logname; } public void setLogName(String logname) { this.logname = logname; } public void setPassWord(String password) { this.password = password; } public String getPassWord() { return this.password; } public void setEmail(String email) { this.email = email; } public String getEmail() { return this.email; } public void reset(ActionMapping mapping, HttpServletRequest request) { logname = null; password = null; email = null; } } 4 truts-config.xml <?xml version="1.0" encoding="ISO-8859-1" ?><!--    Licensed to the Apache Software Foundation (ASF) under one or more    contributor license agreements.  See the NOTICE file distributed with    this work for additional information regarding copyright ownership.    The ASF licenses this file to You under the Apache License, Version 2.0    (the "License"); you may not use this file except in compliance with    the License.  You may obtain a copy of the License at            http://www.apache.org/licenses/LICENSE-2.0       Unless required by applicable law or agreed to in writing, software    distributed under the License is distributed on an "AS IS" BASIS,    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    See the License for the specific language governing permissions and    limitations under the License.--> <!DOCTYPE struts-config PUBLIC          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"          "http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config>      <form-beans>        <form-bean name="simpleForm" type="org.cjea.Struts.example.RegUserForm"/>     </form-beans>    <action-mappings>        <action path="/RegUser"                type="org.cjea.Struts.example.RegUserAction"                name="simpleForm"                scope="request"                validate="false">            <forward name="success" path="/html-good.jsp"/>            <forward name="fails" path="/html-error.jsp"/>        </action>    </action-mappings>     <message-resources            parameter="org.apache.struts.webapp.el.exercise.ApplicationResources"            null="false"/> </struts-config>  

阅读全文(3356) | 回复(1) | 编辑 | 精华

回复:我的第一个struts
aa(游客)发表评论于2007/12/2 21:22:18

http://zol.zhuaxia.com/item/576762965/?logId=207

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除

» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)
站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.373 second(s), page refreshed 144766751 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号