当前位置: 首页 > ops >正文

贴吧项目总结二

标题404路径没有映射到错误

404 - 请求的网页不

前面注解没有学好,只写了@ParamAuto String username,参数没有注入,找了半天,才发现是自己落下了参数,界面是最累的了

public Map<String,Object> login(@ParamAuto("username") String username, @ParamAuto("password") String password
) {}

几个input输入框里面插一行不一样的样式

验证码控件这块太麻烦了,最后还是flex布局,将其分为两份和一份,中间间隔一点点

<div class="input-group" id="input-group-email" style="display: flex; align-items: end; gap: 10px;"><!-- 验证码输入框:占 2--><div style="flex: 2; position: relative;"><input type="text" id="email-code" placeholder=" " required><label for="email-code">验证码</label></div><!-- 发送按钮:占 1--><button type="button" id="send-code-btn" style="flex: 1; padding: 12px 0; font-size: 14px; border: none; border-radius: 5px; background: #4285f4; color: white; cursor: pointer;white-space: nowrap;">获取验证码</button></div>

<form action="" id="registerForm"><div class="input-group"><input type="text" id="username" placeholder=" "><label for="username"> 用户名</label><div class="error-message" id="username-error"></div></div><div class="input-group"><input type="text" id="email" placeholder=" "><label for="email"> 邮箱 </label><div class="error-message" id="email-error"></div></div><!-- 邮箱验证码 --><div class="input-group" id="input-group-email" style="display: flex; align-items: end; gap: 10px;"><!-- 验证码输入框:占 2--><div style="flex: 2; position: relative;"><input type="text" id="email-code" placeholder=" " required><label for="email-code">验证码</label></div><!-- 发送按钮:占 1--><button type="button" id="send-code-btn" style="flex: 1; padding: 12px 0; font-size: 14px; border: none; border-radius: 5px; background: #4285f4; color: white; cursor: pointer; white-space: nowrap;">获取验证码</button></div><!-- 错误信息仍然放在整行下方 --><div class="error-message" id="email-code-error" style="margin-top: 5px;"></div><div class="input-group"><input type="password" id="password" placeholder=" "><label for="password"> 密码</label><div class="error-message" id="password-error"></div></div><div class="input-group"><input type="password" id="confirm-password" placeholder=" "><label for="password"> 确认密码</label><div class="error-message" id="confirm-password-error"></div></div><button type="submit">登 录</button><div class="links"><a href="../index.html">已经有账号?点击这里登录</a></div><div class="links"><a href="forget-password.html">忘记密码</a></div></form>
/* Flex布局实现垂直水平居中 */
body {margin: 0;height: 100vh;display: flex;justify-content: center;align-items: center;background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);font-family: 'Arial', sans-serif;
}.login-container {width: 400px;padding: 40px;background: white;border-radius: 10px;box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);animation: fadeIn 0.5s ease;
}@keyframes fadeIn {from { opacity: 0; transform: translateY(-20px); }to { opacity: 1; transform: translateY(0); }
}h2 {text-align: center;margin-bottom: 30px;
}.input-group{margin-bottom: 5px;position: relative;
}input {width: 90%;padding: 12px 15px;border: 1px solid #ddd;border-radius: 5px;font-size: 16px;transition: border 0.3s;
}input:focus {border-color: #4285f4;outline: none;box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}label {position: absolute;left: 15px;top: 12px;color: #999;transition: all 0.3s;pointer-events: none;
}input:focus + label,
input:not(:placeholder-shown) + label {top: -10px;left: 10px;font-size: 12px;background: white;padding: 0 5px;color: #4285f4;
}button {width: 100%;padding: 12px;background: #4285f4;color: white;border: none;border-radius: 5px;font-size: 16px;cursor: pointer;transition: background 0.3s;
}
button:hover {background: #3367d6;
}.error-message {color: #d32f2f;font-size: 14px;margin-top: 5px;height: 20px;
}
.links{display: flex;justify-content: space-between;margin-top: 20px;font-size: 14px;
}
.links a{color: #4285f4;text-decoration:none ;transition:0.3s;
}
.links a:hover{color: #3367d6;text-decoration: underline;
}

405错误

看了,原因就是因为我的数据发送过去,没有响应,但是发送成功了,就是servlet有问题,之前没有看懂,这算个总结吧.

第二次遇到这个问题了.

:::warning
这个就是因为我继承的时候用的是普通的HttpServlet的原因,我没有用到BaseServlet

:::

查了一下,是以下的原因

405 状态码表示 “方法不被允许(Method Not Allowed)”。这意味着客户端(通常是浏览器)试图使用一种服务器不允许的 HTTP 方法来访问某个资源。例如,服务器可能只允许使用 GET 方法来获取某个 HTML 文件,但客户端却使用了 POST 方法进行访问,此时就会出现 405 错误。

今天又吃亏了,写了半天验证码,结果要用双 token,原本写的时候是想用双token解决请求的,唉,没有把知识串联起来

得到一个经验教训,首先学什么东西的时候要心里有个数,知道这项技术大概适用于什么的,学了双token,结果不知道怎么使用,前后端交互还是用的Session,也怪我但是就真的只看了双token,没有看Session和Cookie,太可惜了

http://www.xdnf.cn/news/15579.html

相关文章:

  • 神经网络常见激活函数 15-B-SiLU 函数
  • 如何在银河麒麟桌面系统中启用 sudo 密码的星号反馈
  • 数据结构排序算法总结(C语言实现)
  • Planning Agent:基于大模型的动态规划与ReAct机制,实现复杂问题自适应执行求解
  • 【软件测试】软件测试分类与方法解析:目标到工具
  • 【Dv3Admin】菜单管理集成阿里巴巴自定义矢量图标库
  • Linux手动安装Nginx(基于Centos 7)
  • 网络通信之基础知识
  • 项目的存量接口怎么低成本接入MCP?
  • 暑期算法训练.3
  • Android设备标识符详解:IMEI、ANDROID_ID与OAID
  • 针对教育行业的网络安全方案有哪些
  • 软件测试面试常见问题【含答案】
  • Effective Modern C++ 条款13:优先考虑const_iterator而非iterator
  • docker安装、启动jenkins服务,创建接口自动化定时任务(mac系统)
  • Python基础--嵌套循环
  • vuex的理解以及应用
  • Pytorch深度学习框架实战教程03:Tensor 的创建、属性、操作与转换详解
  • Java网络通信:UDP和TCP
  • Python-TCP编程-UDP编程-SocketServer-IO各种概念及多路复用-asyncio-学习笔记
  • ELK日志分析部署(小白的“升级打怪”成长之路)
  • javaweb学习开发代码_HTML-CSS-JS
  • 如何用 Python + LLM 构建一个智能栗子表格提取工具?
  • AWS Lambda 最佳实践:构建高效无服务器应用的完整指南
  • Python 网络爬虫 —— requests 库和网页源代码
  • 永磁同步电机MTPA与MTPV曲线具体仿真实现
  • 大模型领域主流向量模型相似度算法、架构及指标对比
  • 在windows平台上基于OpenHarmony sdk编译三方库并暴露给ArkTS使用(详细)
  • 数据结构 栈(1)
  • 聚观早报 | 英伟达股价再创新高;中国联通eSIM手机业务开通上线;中国AI加速出海 阿里云提供全栈能力支持