- 浏览: 564042 次
文章分类
最新评论
DoJo写注册页面
1、新建web项目,文件结构如下图:
2、在WebRoot下新建Register.jsp
Register.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>注册页面</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="../dojoroot/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" type="text/css" href="../dojoroot/dojo/resources/dojo.css"> <script type="text/javascript" src="../dojoroot/dojo/dojo.js"></script> <script type="text/javascript"> dojo.require("dojo.parser"); dojo.require("dijit.form.Button"); dojo.require("dijit.form.TextBox"); dojo.require("dijit.form.RadioButton"); dojo.require("dijit.layout.AccordionContainer"); dojo.require("dijit.dijit.form.ValidationTextBox"); </script> </head> <body class="tundra"> <div dojoType="dijit.layout.AccordionContainer"> <div dojoType="dijit.layout.ContentPane" title="注册界面" style="background: #CCCCCC;width:23%; text-align: center;"> <label for="username">用户名:</label> <input type="text" id="username" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" missingMessage="请输入用户名" propercase="true"/><br/><br/> <input type="radio" id="male" name="sex" dojoType="dijit.form.RadioButton"/>男 <input type="radio" id="female" name="sex" dojoType="dijit.form.RadioButton"/>女<br/><br/> <label for="password">密码:</label> <input type="password" id="password" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" missingMessage="请输入密码" propercase="true"/><br/><br/> <label for="passworda">确认密码:</label> <input type="password" id="passworda" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" missingMessage="请再次输入密码" propercase="true"/><br/><br/> <label for="qq">QQ号码:</label> <input type="text" id="qq" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" propercase="true"/><br/><br/> <label for="telephone">电话号码:</label> <input type="text" id="telephone" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" propercase="true"/><br/><br/> <label for="cellphone">移动号码:</label> <input type="text" id="cellphone" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" propercase="true"/><br/><br/> <label for="email">email:</label> <input type="text" id="email" dojoType="dijit.dijit.form.ValidationTextBox" trim="true" required="true" propercase="true" regExp="[a-z0-9._%+-]+@[a-z0-9]+\.[a-z]{2,4}" invalidMessage="请输入有效的邮箱地址"/><br/><br/> <button type="button" dojoType="dijit.form.Button">注册</button> <button type="reset" dojoType="dijit.form.Button">取消</button> </div> </div> </body> </html>
3、配置Tomcat中的server.xml
server.xml:
<?xml version='1.0' encoding='utf-8'?> <!-- 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. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost"> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> <Context path="/dojo" docBase="D:\MyEclipse\workspace\dojo\WebRoot" reloadable="true"/> </Host> </Engine> </Service> </Server>
4、运行dojo项目,http://localhost:8080/dojo/Register.jsp,结果如下图:
相关推荐
Ajax(Asynchronous JavaScript and XML)技术则允许页面在不刷新整个页面的情况下与服务器进行交互,提升用户体验。在Struts2中,我们可以利用其内建的Ajax支持,如Dojo Taglib,来实现异步数据验证。 在标题提及...
3. **事件处理**:dojo/on模块允许开发者注册和管理事件监听器,支持事件委托和事件对象标准化,使事件处理更加简单。 4. **数据绑定**:dojo/Stateful和dojo/store等模块实现了数据模型与视图之间的双向绑定,简化...
例如,`parseOnLoad: true` 表示 Dojo 在 DOM 加载完成后会自动解析页面中具有 `dojoType` 属性的元素。`isDebug: false` 控制是否启用调试输出,`debugContainerId` 指定了调试信息输出的位置,而 `basescriptUri` ...
- 这种做法特别适用于那些只需要在特定页面或应用中使用的Dojo功能。 4. **实例化Dojo对象**: - 实例化Dojo对象是使用Dojo的重要步骤之一。 - 下面是具体的步骤: - **步骤1:定义Dojo dijit主题样式**: - ...
在这个版本中,它提供了一套全面的AJAX功能,使得在不刷新整个页面的情况下,可以实现与服务器的异步通信,从而提升用户体验。 AJAX(Asynchronous JavaScript and XML)是一种在无需重新加载整个网页的情况下,...
其中`async: true`表示允许异步加载模块,这对于提高页面加载速度非常有用;而`packages`属性则用于注册自定义的模块包位置,方便在后续代码中引用。 2. **加载Dojo核心库** 加载Dojo的核心库可以通过引入`dojo/...
在"dojo grid example"中,我们可以看到一个实际的应用示例,它演示了如何在页面上集成和配置Dojo Grid。这个压缩包文件"dojoGridSample"可能包含了以下关键内容: 1. HTML模板:HTML文件通常包含Dojo Grid所需的...
在使用Jetty Dojo时,开发者通常需要对Jetty的基本概念有所了解,例如端口配置、部署目录结构、Servlet和过滤器的注册等。此外,熟悉Java Web开发和Servlet API也是必要的,因为大部分Web应用都是基于这些技术构建的...
在Web开发中,如果项目涉及到邮件功能,例如用户注册验证邮件、通知邮件等,可能会用到这个库。 - **soap.jar**:这个文件可能包含了处理SOAP协议的Java类,比如Apache Axis或者JAX-WS的一部分,用于构建和消费SOAP...
用最近的dojo1.2.1制作前端的ajax购书网站,分注册用户购物和非注册用户购物两部分(其实非注册用户只是个噱头),一个页面完成所有必要功能,页面颜色有点难看,管理员部分没有做。后端为servlet+ms sqlserver2k,...
在这个例子中,我们使用`dojo.dnd.HtmlDragSource`类来注册所有类名为`divdrag`的元素。 ```javascript dojo.require("dojo.style"); dojo.require("dojo.dnd.*"); function init() { var arr = dojo....
注册一个leetcode账号,官方地址: 如果你使用java,ios,android,可以到 下载简易环境 关于结对编程的知识可以在 做一些了解 由于组织员的能力有限,欢迎大家联系群管理员共建各种语言的初始化环境,当前为内部群...
在本文中,我们将探讨如何使用PHP和Dojo框架来实现一个功能,即允许用户通过拖放操作改变页面布局,并将这些布局保存到数据库中。首先,我们需要了解PHP和Dojo的基本概念。 PHP(Hypertext Preprocessor)是一种...
在页面中引入Dojo库,并设置相关配置,如`isDebug`、`parseOnload`等。然后,可以定义一个函数`retrieveusername`,这个函数可以用来获取并显示与当前用户名关联的密码。具体实现可能涉及Dojo中的`dojo/on`模块监听...
- **异步通信(Ajax)**:通过 `dojo.io.bind` 实现 XMLHttpRequest 操作,从而实现页面局部刷新或后台数据交互。 - **DOM 操作**:提供了一组函数来简化文档对象模型的操作,包括元素的创建、查询和修改。 - **动画...
2. 注册自定义组件:在faces-config.xml文件中,需要声明这个自定义组件及其渲染器,确保JSF知道如何处理这个组件。 ```xml <tag-name>customHead <component-type>com.example.CustomHead</component-type>...
隔离朋友用AWS发射-ec2-3-22-101-64.us-east-2.compute.amazonaws.com一个易于使用的Web应用程序,供用户在隔离期间查找...登录和注册TODO for 3/30-4/1 编辑用户页面 添加其他数据库 更多路线 完成大多数前端 编辑验证
10. **插件系统**:Struts2有一个强大的插件系统,允许开发者扩展框架的功能,如 strut2-dojo-plugin 提供了与Dojo JavaScript库的集成,strut2-convention-plugin 提供了基于约定优于配置的Action自动映射。...
访问Esri的官方网站,找到ArcGIS JavaScript API的下载页面,选择合适的版本进行下载。下载的压缩包通常包含lib、images、dojo等目录,这些是API的核心组成部分。 步骤二:解压并配置 将下载的压缩包解压到你的项目...
这里的`bootstrap`函数初始化了引擎,设置加载状态,加载Dojo库,并根据URL加载页面或组件。这样的设计使得代码结构清晰,易于理解和维护。 总的来说,AJAX设计模式强调的是创建高效、交互性强的Web应用。通过精心...