feat: finish bilingual session auth learning lab
This commit is contained in:
@@ -42,8 +42,8 @@
|
||||
}</pre>
|
||||
|
||||
<div class="links">
|
||||
<a class="btn" href="../../ajax">Open action JSON</a>
|
||||
<a class="btn" href="../../api/users">Open REST JSON</a>
|
||||
<a class="btn" href="../../ajax.action">Open action JSON</a>
|
||||
<a class="btn" href="../../api/users.action">Open REST JSON</a>
|
||||
<a class="btn" href="../../index.jsp">Back to portal</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}</pre>
|
||||
|
||||
<div class="links">
|
||||
<a class="btn" href="../../hello?name=Platform%20Team">Run hello action</a>
|
||||
<a class="btn" href="../../hello.action?name=Platform%20Team">Run hello action</a>
|
||||
<a class="btn" href="../../index.jsp">Back to portal</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Model Binding Guide</title>
|
||||
<title>模型绑定指南</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 24px; font-family: "Aptos", "Segoe UI", sans-serif; background: linear-gradient(135deg, #7c3aed, #a855f7); }
|
||||
.shell { max-width: 980px; margin: 0 auto; background: rgba(255,255,255,0.96); border-radius: 28px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); }
|
||||
@@ -18,22 +18,22 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="shell">
|
||||
<div class="eyebrow">Guide</div>
|
||||
<h1>Property binding vs model-driven binding</h1>
|
||||
<p>This note helps explain how Struts2 turns request parameters into action state. It works well alongside the user form and validation examples.</p>
|
||||
<div class="eyebrow">指南</div>
|
||||
<h1>属性绑定与 ModelDriven 绑定怎么理解</h1>
|
||||
<p>这页用来解释 Struts2 如何把请求参数装配进 Action。建议配合用户资料表单和字段校验实验一起看。</p>
|
||||
|
||||
<h2>Property-driven</h2>
|
||||
<h2>属性驱动绑定</h2>
|
||||
<ul>
|
||||
<li>Define simple fields directly on the action.</li>
|
||||
<li>Expose setters and getters for each form field.</li>
|
||||
<li>Great for short demos and small forms.</li>
|
||||
<li>直接在 Action 上定义简单字段。</li>
|
||||
<li>为表单字段提供对应的 setter / getter。</li>
|
||||
<li>适合短流程 Demo 和小型表单。</li>
|
||||
</ul>
|
||||
|
||||
<h2>Model-driven</h2>
|
||||
<h2>ModelDriven 绑定</h2>
|
||||
<ul>
|
||||
<li>Return a dedicated model object from <code>getModel()</code>.</li>
|
||||
<li>Keep request data separate from action orchestration logic.</li>
|
||||
<li>Better for larger forms and nested objects.</li>
|
||||
<li>通过 <code>getModel()</code> 返回一个独立模型对象。</li>
|
||||
<li>把请求数据和 Action 编排逻辑拆开。</li>
|
||||
<li>更适合复杂表单和嵌套对象。</li>
|
||||
</ul>
|
||||
|
||||
<pre>public class UserAction extends ActionSupport implements ModelDriven<User> {
|
||||
@@ -46,8 +46,8 @@
|
||||
}</pre>
|
||||
|
||||
<div class="links">
|
||||
<a class="btn" href="../../user/form.jsp">Open user form</a>
|
||||
<a class="btn" href="../../index.jsp">Back to portal</a>
|
||||
<a class="btn" href="../../userFormPage.action">打开用户表单实验</a>
|
||||
<a class="btn" href="../../index.action">返回门户</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Upload Guide</title>
|
||||
<title>上传实验指南</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 24px; font-family: "Aptos", "Segoe UI", sans-serif; background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
|
||||
.shell { max-width: 980px; margin: 0 auto; background: rgba(255,255,255,0.96); border-radius: 28px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); }
|
||||
@@ -18,16 +18,16 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="shell">
|
||||
<div class="eyebrow">Guide</div>
|
||||
<h1>Upload demo guide</h1>
|
||||
<p>The refreshed upload flow is deliberately safer for demo use. It shows multipart binding and metadata capture without persisting files.</p>
|
||||
<div class="eyebrow">指南</div>
|
||||
<h1>上传实验怎么讲</h1>
|
||||
<p>现在这条上传链路故意做成“只采集元数据,不真实落盘”的安全版,更适合本地和 VPS 演示环境。</p>
|
||||
|
||||
<h2>Core binding fields</h2>
|
||||
<h2>核心绑定字段</h2>
|
||||
<ul>
|
||||
<li><code>File upload</code> for the primary file object.</li>
|
||||
<li><code>String uploadFileName</code> for the original filename.</li>
|
||||
<li><code>String uploadContentType</code> for the MIME type.</li>
|
||||
<li>Optional lists for multiple files.</li>
|
||||
<li><code>File upload</code> 负责接收主文件对象。</li>
|
||||
<li><code>String uploadFileName</code> 负责接收原始文件名。</li>
|
||||
<li><code>String uploadContentType</code> 负责接收 MIME 类型。</li>
|
||||
<li>多个文件时还可以再接文件列表。</li>
|
||||
</ul>
|
||||
|
||||
<pre>public class FileUploadAction extends ActionSupport {
|
||||
@@ -42,8 +42,8 @@
|
||||
}</pre>
|
||||
|
||||
<div class="links">
|
||||
<a class="btn" href="../../upload/index.jsp">Open upload demo</a>
|
||||
<a class="btn" href="../../index.jsp">Back to portal</a>
|
||||
<a class="btn" href="../../uploadPage.action">打开上传实验</a>
|
||||
<a class="btn" href="../../index.action">返回门户</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user