JavaWeb笔记_JSTL标签库JavaEE三层架构案例

一.JSTL标签库

1.1 JSTL概述

 JSTL(jsp standard tag library):JSP标准标签库,它是针对EL表达式一个扩展,通过JSTL标签库与EL表达式结合可以完成更强大的功能
   JSTL它是一种标签语言,JSTL不是JSP内置标签
   JSTL标签库主要包含:
     ****核心标签
         格式化标签
         SQL标签
         XML标签
         JSTL函数

1.2 JSTL标签库引入

a.JSTL如果要使用需要引入两个jar包:jstl.jar,standard.jar
      b.我们在JSP中手动引入核心标签库
         prefix:前缀(别名)
         uri:uri指定的路径中定义了这些核心标签
         <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

1.3 if标签

<%--test属性中写即将做判断的EL表达式
        如果test属性中EL表达式最终结果为true,将执行if标签中的内容
        --%> 

 

<%@ page import="bean.Person" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head><title>JSTL标签if标签的使用</title>
</head>
<body><%request.setAttribute("p1",new Person(18,"male"));request.setAttribute("p2",new Person(20,"man"));%><c:if test="${!empty p1}">login success</c:if><br><c:if test="${!empty p2}">${p2.age}岁性别${p2.gender} login success</c:if><br><c:if test="${empty p2.name && p2.gender=='man'}">${p2.age}</c:if>
</body>
</html>

1.4 forEach标签

 <%--forEach标签遍历List集合
            items:通过EL表达式取出遍历的集合对象
            var:把每次遍历到的对象,以及var对应值存储到pageContext域中
                例如:var="user" pageContext.setAttribute("user",每次遍历到对象)
          --%>
        <%--var:当遍历map时,每次把遍历到entry对象(封装着key=value)存储到pageContext域--%>
            <%--    例如:var="entry" pageContext.setAttribute("entry",每次遍历到的entry对象)--%>

<%@ page import="bean.Person" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.HashMap" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>forEach标签使用</title>
</head>
<body><%//list集合List<Person> peoples = Arrays.asList(new Person("张三", 18, "man"),new Person("李四", 20, "male"));request.setAttribute("peoples", peoples);//map集合HashMap<String, Person> map = new HashMap<>();map.put("张三", new Person(18, "man"));map.put("001", new Person(20, "male"));session.setAttribute("map", map);%><c:if test="${!empty peoples}"><c:forEach items="${peoples}" var="people">${people.name},${people.age},${people.gender}<br></c:forEach></c:if><c:if test="${!empty map}"><c:forEach items="${map}" var="entry">${entry.key},${entry.value.age},${entry.value.gender}<br></c:forEach></c:if>
</body>
</html>

二.JavaEE三层架构

   web层:JSP/Servlet 主要用于显示数据以及接收客户端的数据
  service层:主要负责业务处理,存放业务逻辑相关的代码(数据验证,事务处理..)
  dao层:负责跟数据库打交道,负责数据库访问,操作数据库相关代码

 

三.登录案例

 web层

//登录判断
@WebServlet("/loginServlet")
public class loginServlet extends HttpServlet {@Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doPost(request, response);}@Overrideprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//获取表单传过来的参数,并将参数封装为对象String username = request.getParameter("username");String password = request.getParameter("password");//将用户输入的用户名和密码封装成User对象User user = new User(username, password);//最终在数据库中查询到的User对象User finalyUser = UserServlet.getFinalyUser(user);//判断finalyUser,若为空,则在数据库中查询不到,登录失败,反之登录成功if (finalyUser!=null){request.setAttribute("statusCode",100);request.setAttribute("msg","登录成功");//将正确的user用户信息存储在session域中request.getSession().setAttribute("user",finalyUser);}else {request.setAttribute("statusCode",101);request.setAttribute("msg","用户名或密码错误");//将来在页面回显用户输入的错误信息,方便用户进行修改request.setAttribute("user",user);}//转发到login页面,与login页面公用相同的request,response对象,方便回显信息request.getRequestDispatcher("/login.jsp").forward(request,response);}
}
//注销
@WebServlet("/loginoutServlet")
public class loginoutServlet extends HttpServlet {@Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doPost(request, response);}@Overrideprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//注销request.getSession().invalidate();response.sendRedirect(request.getContextPath()+"/index.jsp");}
}

service层

//将dao层返回的User对象返回给web层
public class UserServlet  {public static User getFinalyUser(User user){return Userdao.queryUser(user);}
}

dao层

//对数据库进行查询
public class Userdao {User user=null;public static User queryUser(User user) {QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());User queryuser;try {queryuser = qr.query("SELECT * FROM user WHERE username=? and password=?",new BeanHandler<>(User.class), user.getUsername(), user.getPassword());} catch (SQLException e) {throw new RuntimeException(e);}return queryuser;}
}

Utils工具包

public class JDBCUtils {/*构造函数私有化不允许在类外创建对象*/private JDBCUtils() {}private static BasicDataSource bs;static {Properties properties = new Properties();InputStream is = JDBCUtils.class.getClassLoader().getResourceAsStream("db.properties");try {/*从流中将配置文件中的数据加载到集合中*/properties.load(is);//创建一个连接池bs = new BasicDataSource();//设置连接池参数/*必备的四个参数*/bs.setDriverClassName(properties.getProperty("DRIVER"));bs.setUrl(properties.getProperty("URL"));bs.setUsername(properties.getProperty("USER"));bs.setPassword(properties.getProperty("PASSWORD"));/*设置可选参数*/bs.setInitialSize(12);bs.setMaxTotal(12);bs.setMaxIdle(2);bs.setMinIdle(1);bs.setMaxWaitMillis(30000);} catch (Exception e) {e.printStackTrace();}}public static Connection getConnection() {Connection con=null;//提升作用域try {con=bs.getConnection();} catch (SQLException e) {e.printStackTrace();}return con;}public static DataSource getDataSource() {return bs;}
}

登录界面(利用bootstrap框架)

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content=""><meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors"><meta name="generator" content="Jekyll v4.1.1"><title>Signin Template · Bootstrap</title><link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css"><script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script><script src="${pageContext.request.contextPath}/js/bootstrap.bundle.min.js"></script><script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script><link rel="canonical" href="https://getbootstrap.com/docs/4.5/examples/sign-in/"><!-- Bootstrap core CSS --><link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet"><script>window.onload = function () {<c:if test="${!empty statusCode && statusCode==100}">$('#success').modal('show');//将指定id的模态框弹出window.setTimeout("window.location.href='${pageContext.request.contextPath}/index.jsp'",2000)</c:if>};</script><style>.bd-placeholder-img {font-size: 1.125rem;text-anchor: middle;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}@media (min-width: 768px) {.bd-placeholder-img-lg {font-size: 3.5rem;}}</style><!-- Custom styles for this template --><link href="${pageContext.request.contextPath}/css/signin.css" rel="stylesheet">
</head>
<body class="text-center">
<form class="form-signin" action="${pageContext.request.contextPath}/loginServlet" method="post"><img class="mb-4" src="${pageContext.request.contextPath}/img/bootstrap-solid.svg" alt="" width="72" height="72"><h1 class="h3 mb-3 font-weight-normal">请登录</h1><c:if test="${empty statusCode || statusCode==100}"><label for="inputUsername" class="sr-only">用户名</label> <!-- 修改label的for属性和文本 --><input type="text" name="username" id="inputUsername" class="form-control" placeholder="Username" required autofocus> <!-- 修改input的type和placeholder --></c:if><c:if test="${!empty statusCode && statusCode!=100}"><label for="inputUsername" class="sr-only">用户名</label> <!-- 修改label的for属性和文本 --><input type="text" id="inputUsername" name="username" value="${user.username}" class="form-control is-invalid" placeholder="Username" required autofocus> <!-- 修改input的type和placeholder --></c:if><c:if test="${empty statusCode || statusCode==100}"><label for="inputPassword" class="sr-only">密码</label><input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required></c:if><c:if test="${!empty statusCode && statusCode!=100}"><label for="inputPassword" class="sr-only">密码</label><input type="password" id="inputPassword" name="password" value="${user.password}" class="form-control is-invalid" placeholder="Password" required><div class="invalid-feedback">${msg}</div></c:if><%--弹出框--%><div class="modal fade" id="success" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-body">${msg}!正在进入首页</div></div></div></div><div class="checkbox mb-3"><label><input type="checkbox" value="remember-me"> 记住我</label></div><button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
</form>
</body>
</html>

 主界面(利用bootstrap框架)

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content=""><meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors"><meta name="generator" content="Jekyll v4.1.1"><title>Blog Template · Bootstrap</title><link rel="canonical" href="https://getbootstrap.com/docs/4.5/examples/blog/"><!-- Bootstrap core CSS --><link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet"><style>.bd-placeholder-img {font-size: 1.125rem;text-anchor: middle;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}@media (min-width: 768px) {.bd-placeholder-img-lg {font-size: 3.5rem;}}</style><!-- Custom styles for this template --><link href="https://fonts.googleapis.com/css?family=Playfair+Display:700,900" rel="stylesheet"><!-- Custom styles for this template --><link href="${pageContext.request.contextPath}/css/blog.css" rel="stylesheet">
</head>
<body>
<div class="container"><header class="blog-header py-3"><div class="row flex-nowrap justify-content-between align-items-center"><div class="col-4 pt-1"><a class="text-muted" href="#">Subscribe</a></div><div class="col-4 text-center"><a class="blog-header-logo text-dark" href="#">Large</a></div><c:if test="${!empty user}"><div class="col-4 d-flex justify-content-end align-items-center"><a class="text-muted" href="#" aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="mx-3" role="img" viewBox="0 0 24 24" focusable="false"><title>Search</title><circle cx="10.5" cy="10.5" r="7.5"/><path d="M21 21l-5.2-5.2"/></svg></a><a href="#" class="btn btn-sm btn-outline-secondary">${user.username}</a><a class="btn btn-sm btn-outline-secondary" href="${pageContext.request.contextPath}/loginoutServlet">Sign out</a></div></c:if><c:if test="${empty user}"><div class="col-4 d-flex justify-content-end align-items-center"><a class="text-muted" href="#" aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="mx-3" role="img" viewBox="0 0 24 24" focusable="false"><title>Search</title><circle cx="10.5" cy="10.5" r="7.5"/><path d="M21 21l-5.2-5.2"/></svg></a><a class="btn btn-sm btn-outline-secondary" href="${pageContext.request.contextPath}/login.jsp">Sign up${statusCode}</a></div></c:if></div></header><div class="nav-scroller py-1 mb-2"><nav class="nav d-flex justify-content-between"><a class="p-2 text-muted" href="#">World</a><a class="p-2 text-muted" href="#">U.S.</a><a class="p-2 text-muted" href="#">Technology</a><a class="p-2 text-muted" href="#">Design</a><a class="p-2 text-muted" href="#">Culture</a><a class="p-2 text-muted" href="#">Business</a><a class="p-2 text-muted" href="#">Politics</a><a class="p-2 text-muted" href="#">Opinion</a><a class="p-2 text-muted" href="#">Science</a><a class="p-2 text-muted" href="#">Health</a><a class="p-2 text-muted" href="#">Style</a><a class="p-2 text-muted" href="#">Travel</a></nav></div><div class="jumbotron p-4 p-md-5 text-white rounded bg-dark"><div class="col-md-6 px-0"><h1 class="display-4 font-italic">Title of a longer featured blog post</h1><p class="lead my-3">Multiple lines of text that form the lede, informing new readers quickly and efficiently about what’s most interesting in this post’s contents.</p><p class="lead mb-0"><a href="#" class="text-white font-weight-bold">Continue reading...</a></p></div></div><div class="row mb-2"><div class="col-md-6"><div class="row no-gutters border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative"><div class="col p-4 d-flex flex-column position-static"><strong class="d-inline-block mb-2 text-primary">World</strong><h3 class="mb-0">Featured post</h3><div class="mb-1 text-muted">Nov 12</div><p class="card-text mb-auto">This is a wider card with supporting text below as a natural lead-in to additional content.</p><a href="#" class="stretched-link">Continue reading</a></div><div class="col-auto d-none d-lg-block"><svg class="bd-placeholder-img" width="200" height="250" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Thumbnail"><title>Placeholder</title><rect width="100%" height="100%" fill="#55595c"/><text x="50%" y="50%" fill="#eceeef" dy=".3em">Thumbnail</text></svg></div></div></div><div class="col-md-6"><div class="row no-gutters border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative"><div class="col p-4 d-flex flex-column position-static"><strong class="d-inline-block mb-2 text-success">Design</strong><h3 class="mb-0">Post title</h3><div class="mb-1 text-muted">Nov 11</div><p class="mb-auto">This is a wider card with supporting text below as a natural lead-in to additional content.</p><a href="#" class="stretched-link">Continue reading</a></div><div class="col-auto d-none d-lg-block"><svg class="bd-placeholder-img" width="200" height="250" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Thumbnail"><title>Placeholder</title><rect width="100%" height="100%" fill="#55595c"/><text x="50%" y="50%" fill="#eceeef" dy=".3em">Thumbnail</text></svg></div></div></div></div>
</div><main role="main" class="container"><div class="row"><div class="col-md-8 blog-main"><h3 class="pb-4 mb-4 font-italic border-bottom">From the Firehose</h3><div class="blog-post"><h2 class="blog-post-title">Sample blog post</h2><p class="blog-post-meta">January 1, 2014 by <a href="#">Mark</a></p><p>This blog post shows a few different types of content that’s supported and styled with Bootstrap. Basic typography, images, and code are all supported.</p><hr><p>Cum sociis natoque penatibus et magnis <a href="#">dis parturient montes</a>, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.</p><blockquote><p>Curabitur blandit tempus porttitor. <strong>Nullam quis risus eget urna mollis</strong> ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></blockquote><p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p><h2>Heading</h2><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p><h3>Sub-heading</h3><p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p><pre><code>Example code block</code></pre><p>Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa.</p><h3>Sub-heading</h3><p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p><ul><li>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</li><li>Donec id elit non mi porta gravida at eget metus.</li><li>Nulla vitae elit libero, a pharetra augue.</li></ul><p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p><ol><li>Vestibulum id ligula porta felis euismod semper.</li><li>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</li><li>Maecenas sed diam eget risus varius blandit sit amet non magna.</li></ol><p>Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis.</p></div><!-- /.blog-post --><div class="blog-post"><h2 class="blog-post-title">Another blog post</h2><p class="blog-post-meta">December 23, 2013 by <a href="#">Jacob</a></p><p>Cum sociis natoque penatibus et magnis <a href="#">dis parturient montes</a>, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.</p><blockquote><p>Curabitur blandit tempus porttitor. <strong>Nullam quis risus eget urna mollis</strong> ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></blockquote><p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p></div><!-- /.blog-post --><div class="blog-post"><h2 class="blog-post-title">New feature</h2><p class="blog-post-meta">December 14, 2013 by <a href="#">Chris</a></p><p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p><ul><li>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</li><li>Donec id elit non mi porta gravida at eget metus.</li><li>Nulla vitae elit libero, a pharetra augue.</li></ul><p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p><p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p></div><!-- /.blog-post --><nav class="blog-pagination"><a class="btn btn-outline-primary" href="#">Older</a><a class="btn btn-outline-secondary disabled" href="#" tabindex="-1" aria-disabled="true">Newer</a></nav></div><!-- /.blog-main --><aside class="col-md-4 blog-sidebar"><div class="p-4 mb-3 bg-light rounded"><h4 class="font-italic">About</h4><p class="mb-0">Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p></div><div class="p-4"><h4 class="font-italic">Archives</h4><ol class="list-unstyled mb-0"><li><a href="#">March 2014</a></li><li><a href="#">February 2014</a></li><li><a href="#">January 2014</a></li><li><a href="#">December 2013</a></li><li><a href="#">November 2013</a></li><li><a href="#">October 2013</a></li><li><a href="#">September 2013</a></li><li><a href="#">August 2013</a></li><li><a href="#">July 2013</a></li><li><a href="#">June 2013</a></li><li><a href="#">May 2013</a></li><li><a href="#">April 2013</a></li></ol></div><div class="p-4"><h4 class="font-italic">Elsewhere</h4><ol class="list-unstyled"><li><a href="#">GitHub</a></li><li><a href="#">Twitter</a></li><li><a href="#">Facebook</a></li></ol></div></aside><!-- /.blog-sidebar --></div><!-- /.row --></main><!-- /.container --><footer class="blog-footer"><p>Blog template built for <a href="https://getbootstrap.com/">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p><p><a href="${pageContext.request.contextPath}/login.jsp">Back to top</a></p>
</footer>
</body>
</html>

最终效果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/383668.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Windows本地启动Redis

找到本地redis目录 输入cmd,然后输入redis-server.exe redis.windows.conf&#xff0c;默认端口为6379 再新打开一个cmd&#xff0c;输入redis-cli.exe -p 6379 -a &#xff08;你在redis.windows.conf中设置的密码&#xff09;

.NET程序集编辑器/调试器 dnSpy 使用介绍

原文链接&#xff1a;https://www.cnblogs.com/zhaotianff/p/17352882.html dnSpy dnSpy是一个.NET程序集调试器和编辑器。它可以用它来编辑和调试程序集&#xff0c;即使在没有源码的情况下。 主要功能&#xff1a; 调试.NET和Unity程序集 编辑.NET和Unity程序集 项目地…

25.x86游戏实战-理解发包流程

免责声明&#xff1a;内容仅供学习参考&#xff0c;请合法利用知识&#xff0c;禁止进行违法犯罪活动&#xff01; 本次游戏没法给 内容参考于&#xff1a;微尘网络安全 工具下载&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1rEEJnt85npn7N38Ai0_F2Q?pwd6tw3 提…

IOS微软语音转文本,lame压缩音频

在IOS开发中&#xff0c;用微软进行语音转文本操作&#xff0c;并将录音文件压缩后返回 项目中遇到了利用微软SDK进行实时录音转文本操作&#xff0c;如果操作失败&#xff0c;那么就利用原始音频文件通过网络请求操作&#xff0c;最终这份文件上传到阿里云保存&#xff0c;考…

Golang学习笔记20240725,Go语言基础语法

第一个Go程序 package mainimport "fmt"func main() {fmt.Println("hello world") }运行方式1&#xff1a; go run main.go运行方式2&#xff1a; go build .\hello_go.exe运行方式3&#xff1a;goland右键运行 字符串拼接 使用加号可以对字符串进行…

基于微信小程序的校园警务系统/校园安全管理系统/校园出入管理系统

摘要 伴随着社会以及科学技术的发展&#xff0c;小程序已经渗透在人们的身边&#xff0c;小程序慢慢的变成了人们的生活必不可少的一部分&#xff0c;紧接着网络飞速的发展&#xff0c;小程序这一名词已不陌生&#xff0c;越来越多的学校机构等都会定制一款属于自己个性化的小程…

UML通信图建模技术及应用例

新书速览|《UML 2.5基础、建模与设计实践》 在对系统的动态行为进行建模时&#xff0c;通信图常被用于按组织结构对控制流进行建模。与顺序图一样&#xff0c;一个单独的通信图只能显示一个控制流。 使用通信图建模时可以遵循如下策略&#xff1a; &#xff08;1&#xff09…

Centos 8 配置网络源

备份当前的软件源配置文件&#xff1a; sudo cp -a /etc/yum.repos.d /etc/yum.repos.d.bak 清理原有的 yum 仓库配置信息&#xff1a; sudo rm -f /etc/yum.repos.d/*.repo 获取阿里云的 CentOS 8 源配置&#xff1a; sudo curl -o /etc/yum.repos.d/CentOS-Base.repo ht…

错误解决 error CS0117: ‘Buffer‘ does not contain a definition for ‘BlockCopy‘

Unity 2022.3.9f1 导入 Runtime OBJ Importer 后出现&#xff1a; error CS0117: ‘Buffer’ does not contain a definition for ‘BlockCopy’ 解决办法&#xff1a; 源代码&#xff1a; int DDS_HEADER_SIZE 128; byte[] dxtBytes new byte[ddsBytes.Length - DDS_HEAD…

【Vue实战教程】之Vue工程化项目详解

Vue工程化项目 随着多年的发展&#xff0c;前端越来越模块化、组件化、工程化&#xff0c;这是前端发展的大趋势。webpack是目前用于构建前端工程化项目的主流工具之一&#xff0c;也正变得越来越重要。本章节我们来详细讲解一下如何使用webpack搭建Vue工程化项目。 1 使用we…

Axure Web端元件库:从Quick UI到500+组件的飞跃

在快速变化的数字世界中&#xff0c;产品设计不仅仅是功能的堆砌&#xff0c;更是用户体验的精心雕琢。原型设计作为产品开发过程中的关键环节&#xff0c;其重要性不言而喻。Axure&#xff0c;作为业界领先的原型设计工具&#xff0c;凭借其强大的交互设计和丰富的功能&#x…

智慧工地视频汇聚管理平台:打造现代化工程管理的全新视界

一、方案背景 科技高速发展的今天&#xff0c;工地施工已发生翻天覆地的变化&#xff0c;传统工地管理模式很容易造成工地管理混乱、安全事故、数据延迟等问题&#xff0c;人力资源的不足也进一步加剧了监管不到位的局面&#xff0c;严重影响了施工进度质量和安全。 视频监控…

外行对自动驾驶汽车的一些想法-2024-

起源 前段时间有关于自动驾驶汽车的讨论&#xff0c;现在热度终于快过去了。 (⊙﹏⊙) 其实&#xff0c;完全不用担心自动驾驶取代人类。 引用 这是一篇24年4月的报道。 上图为引用&#xff0c;可以看到打工人的忙碌。 2023 一个热爱自动驾驶但妥妥外行之人的思考-2023-C…

mac怎样清理photoshop垃圾的方法 ps清理缓存和垃圾 苹果电脑暂存盘已满怎么清理

很多使用过ps&#xff0c;尤其是Adobe全家桶的小伙伴会发现&#xff0c;这些软件占用缓存很多&#xff0c;而且随着使用时间的增长&#xff0c;缓存也会越多&#xff0c;并不会自动清理。那么mac系统怎么清理ps暂存盘呢&#xff1f;mac又该怎么最高效清理磁盘空间呢&#xff1f…

芯片的计算能力由什么决定

芯片的计算能力由什么决定 芯片的计算能力由多个因素决定。 包括但不限于&#xff1a; 架构设计&#xff1a; 芯片的架构设计决定了其计算单元的数量和类型&#xff0c;以及它们之间的连接方式和通信方式。不同的架构可以提供不同的计算能力和性能。处理器速度&#xff1a; 处…

快速安装torch-gpu和Tensorflow-gpu(自用,Ubuntu)

要更详细的教程可以参考Tensorflow PyTorch 安装&#xff08;CPU GPU 版本&#xff09;&#xff0c;这里是有基础之后的快速安装。 一、Pytorch 安装 conda create -n torch_env python3.10.13 conda activate torch_env conda install cudatoolkit11.8 -c nvidia pip ins…

LeetCode_122(买卖股票的最佳时机)

public int maxProfit(int[] prices) {int ans 0;//int prices[] {7,1,5,3,6,4};for(int i1;i<prices.length;i){ansMath.max(0,prices[i]-prices[i-1]);}return ans;}

DevExpress WinForms自动表单布局,创建高度可定制用户体验(二)

使用DevExpress WinForms的表单布局组件可以创建高度可定制的应用程序用户体验&#xff0c;从自动安排UI控件到按比例调整大小&#xff0c;DevExpress布局和数据布局控件都可以让您消除与基于像素表单设计相关的麻烦。 P.S&#xff1a;DevExpress WinForms拥有180组件和UI库&a…

openmv学习笔记(24电赛笔记)

感光元件 openmv采用小孔摄像模式&#xff0c;将图像映射到感光原件上面&#xff0c;来传递图片&#xff0c;通过图片快速的刷新行成视频&#xff0c;在IDE中通过对感光原件的编辑可以控制视频的效果。 重置感光元件到默认状态 import sensor #导入感光元件这个库sensor.res…

IPD推行成功的核心要素(十五)项目管理提升IPD相关项目交付效率和用户体验

研发项目往往包含很多复杂的流程和具体的细节。因此&#xff0c;一套完整且标准的研发项目管理制度和流程对项目的推进至关重要。研发项目管理是成功推动创新和技术发展的关键因素。然而在实际管理中&#xff0c;研发项目管理常常面临着需求不确定、技术风险、人员素质、成本和…