/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed 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
*
* https://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.
*/
package com.qkwl.demos.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@Controller
public class BasicController {
// http://127.0.0.1:8080/hello?name=lisi
@RequestMapping("/hello")
@ResponseBody
public String hello(@RequestParam(name = "name", defaultValue = "unknown user") String name) {
return "Hello " + name;
}
// http://127.0.0.1:8080/user
@RequestMapping("/user")
@ResponseBody
public User user() {
User user = new User();
user.setName("theonefx");
user.setAge(666);
return user;
}
// http://127.0.0.1:8080/save_user?name=newName&age=11
@RequestMapping("/save_user")
@ResponseBody
public String saveUser(User u) {
return "user will save: name=" + u.getName() + ", age=" + u.getAge();
}
// http://127.0.0.1:8080/html
@RequestMapping("/html")
public String html(){
return "index.html";
}
@ModelAttribute
public void parseUser(@RequestParam(name = "name", defaultValue = "unknown user") String name
, @RequestParam(name = "age", defaultValue = "12") Integer age, User user) {
user.setName("zhangsan");
user.setAge(18);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
SpringCloudAlibaba项目框架搭建详细过程
共127个文件
java:22个
xml:21个
class:17个
6 下载量 127 浏览量
2023-09-25
16:15:19
上传
评论
收藏 74KB RAR 举报
温馨提示
SpringCloudAlibaba项目框架搭建详细过程
资源推荐
资源详情
资源评论
收起资源包目录
SpringCloudAlibaba项目框架搭建详细过程 (127个子文件)
19d6ed56c4e6384971a63a8e6c9498b8d9911b 188B
483570e041eb648703359441d61bf9a5feeb13 212B
566b81b018ad684f3a35fee301741b2734c8f4 141B
5cfcef63aeb6c73691f546497af36a69541a4e 227B
841319ddfa21619eda3b8a3630b09fecee6692 36B
99989def77c3f26810fa35c85e2e94b30c3634 36B
9de29bb2d1d6434b8b29ae775ad8c2e48c5391 15B
a25f7f4cb416c083d265558da75d457237d671 155B
c46abde23e9d254319889d0af91cefe3b5a73c 36B
BasicController.class 2KB
BasicController.class 2KB
BasicController.class 2KB
BasicController.class 2KB
PathVariableController.class 1KB
PathVariableController.class 1KB
PathVariableController.class 1KB
PathVariableController.class 1KB
User.class 775B
User.class 775B
User.class 775B
User.class 775B
SeataBusinessApplication.class 714B
SeataAccountApplication.class 711B
SeataOrderApplication.class 705B
SeataStockApplication.class 705B
QkwlNacosApplication.class 702B
config 130B
description 73B
exclude 240B
.gitignore 395B
.gitignore 395B
.gitignore 395B
.gitignore 395B
.gitignore 395B
.gitignore 395B
.gitignore 184B
.gitignore 184B
HEAD 23B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
index.html 103B
alibaba-cloud.iml 349B
CloudAlibabaProject.iml 307B
seata-account.iml 261B
seata-order.iml 261B
seata-stock.iml 261B
seata-business.iml 261B
index 952B
BasicController.java 2KB
BasicController.java 2KB
BasicController.java 2KB
BasicController.java 2KB
PathVariableController.java 2KB
PathVariableController.java 2KB
PathVariableController.java 2KB
PathVariableController.java 2KB
User.java 1KB
User.java 1KB
User.java 1KB
User.java 1KB
SeataBusinessApplication.java 327B
SeataAccountApplication.java 325B
SeataOrderApplication.java 321B
SeataStockApplication.java 321B
QkwlNacosApplication.java 319B
SeataBusinessApplicationTests.java 216B
SeataAccountApplicationTests.java 215B
SeataOrderApplicationTests.java 213B
SeataStockApplicationTests.java 213B
QkwlNacosApplicationTests.java 212B
HELP.md 851B
HELP.md 851B
HELP.md 851B
HELP.md 851B
HELP.md 851B
HELP.md 851B
.name 23B
pre-rebase.sample 5KB
update.sample 4KB
fsmonitor-watchman.sample 3KB
pre-commit.sample 2KB
prepare-commit-msg.sample 1KB
pre-push.sample 1KB
commit-msg.sample 896B
pre-receive.sample 544B
applypatch-msg.sample 478B
pre-applypatch.sample 424B
pre-merge-commit.sample 416B
post-update.sample 189B
workspace.xml 9KB
workspace.xml 3KB
pom.xml 3KB
pom.xml 3KB
共 127 条
- 1
- 2
资源评论
天空~之城
- 粉丝: 322
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功