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

连江县住房和城乡建设局网站搜索引擎优化教材答案

连江县住房和城乡建设局网站,搜索引擎优化教材答案,南京推广平台有哪些,使用flask做前后端分离的网站个人简介:Java领域新星创作者;阿里云技术博主、星级博主、专家博主;正在Java学习的路上摸爬滚打,记录学习的过程~ 个人主页:.29.的博客 学习社区:进去逛一逛~ 向域对象共享数据一、使用 原生ServletAPI二、…

在这里插入图片描述

个人简介:Java领域新星创作者;阿里云技术博主、星级博主、专家博主;正在Java学习的路上摸爬滚打,记录学习的过程~
个人主页:.29.的博客
学习社区:进去逛一逛~

在这里插入图片描述

向域对象共享数据

  • 一、使用 原生ServletAPI
  • 二、使用 ModelAndView
  • 三、使用Model
  • 四、使用map
  • 五、使用ModelMap
  • 六、Model、ModelMap、Map的关系
  • 七、向session域、application域 共享数据(补充)



一、使用 原生ServletAPI


  • HttpServletRequest.setAttribute()方法 将数据共享至请求作用域(request域);
/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {//使用原生ServletAPI 向请求作用域共享数据@RequestMapping(value = "/testRequestByServletAPI")public String testRequestByServletAPI(HttpServletRequest request){request.setAttribute("testRequestScope","use-ServletAPI-setAttribute(request请求作用域)");return "success";}
}



二、使用 ModelAndView


  • ModelAndView有Model和View的功能;
  • Model主要用于向请求域共享数据;
  • View主要用于设置视图,实现页面跳转;

  • ModelAndView 相关方法
  • ModelAndView.addObject() : 处理模型数据,即:向request请求作用域 共享数据
  • ModelAndView.setViewName() : 设置视图名称
/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {//SpringMVC方式:通过ModelAndView,向请求作用域共享数据@RequestMapping(value = "/testModelandView")public ModelAndView testModelAndView(){ModelAndView mdv = new ModelAndView();//addObject() : 处理模型数据,即:向request请求作用域 共享数据mdv.addObject("testRequestScope","use-ModelAndView-setAttribute(request请求作用域)");//setViewName() : 设置视图名称mdv.setViewName("success");return mdv;     //设置完视图名称后,返回ModelAndView对象即可。}}



三、使用Model


  • Model对象,作为请求控制器方法的形参;
  • Model.addAttribute()方法,将数据共享至请求作用域(request域);
/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {//SpringMVC方式:通过Model,向请求作用域共享数据@RequestMapping(value = "/testModel")public String testModel(Model model){model.addAttribute("testRequestScope","use-Model-setAttribute(request请求作用域)");System.out.println("model:"+model);System.out.println(model.getClass().getName());return "success";}



四、使用map


  • Map对象,作为请求控制器方法的形参;
  • Map.put()方法,将数据共享至请求作用域(request域);
/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {///SpringMVC方式:通过map,向请求作用域共享数据@RequestMapping(value = "/testMap")public String testMap(Map<String,Object> map){map.put("testRequestScope","use-Map-setAttribute(request请求作用域)");System.out.println("map:"+map);System.out.println(map.getClass().getName());return "success";}}



五、使用ModelMap


  • ModelMap对象,作为请求控制器方法的形参;
  • ModelMap.addAttribute()方法,将数据共享至请求作用域(request域);
/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {///SpringMVC方式:通过ModelMap,向请求作用域共享数据@RequestMapping(value = "/testModelMap")public String testModelMap(ModelMap modelMap){modelMap.addAttribute("testRequestScope","use-ModelMap-setAttribute(request请求作用域)");System.out.println("modelMap:"+modelMap);System.out.println(modelMap.getClass().getName());return "success";}}



六、Model、ModelMap、Map的关系


  • Model、ModelMap、Map类型的参数其实本质上都是 BindingAwareModelMap 类型的
    /*** Model、ModelMap、Map的关系 :* Model、ModelMap、Map类型的参数其实本质上都是 BindingAwareModelMap 类型的* public interface Model{}* public class ModelMap extends LinkedHashMap<String, Object> {}* public class ExtendedModelMap extends ModelMap implements Model {}* public class BindingAwareModelMap extends ExtendedModelMap {}*/


七、向session域、application域 共享数据(补充)


/*** @author .29.* @create 2023-03-05 15:30*/
@Controller
public class ScopeController {//用原生ServletAPI,向session作用域共享数据@RequestMapping(value = "/testSession")public String testSession(HttpSession session){session.setAttribute("testSessionScope","use-ServletAPI-setAttribute(session作用域)");return "success";}//用原生ServletAPI,向session作用域共享数据@RequestMapping(value = "/testApplication")public String testApplication(HttpSession session){ServletContext application = session.getServletContext();application.setAttribute("testApplicationScope","use-ServletAPI-setAttribute(Application作用域)");return "success";}}

在这里插入图片描述


文章转载自:
http://trolleyman.sqLh.cn
http://preferment.sqLh.cn
http://diverticulosis.sqLh.cn
http://ensanguine.sqLh.cn
http://tipsiness.sqLh.cn
http://package.sqLh.cn
http://balbriggan.sqLh.cn
http://bvds.sqLh.cn
http://testudinal.sqLh.cn
http://unconjugated.sqLh.cn
http://rutted.sqLh.cn
http://monkly.sqLh.cn
http://casern.sqLh.cn
http://transfers.sqLh.cn
http://deflex.sqLh.cn
http://pointsman.sqLh.cn
http://succade.sqLh.cn
http://tried.sqLh.cn
http://machicolate.sqLh.cn
http://cirsectomy.sqLh.cn
http://charr.sqLh.cn
http://maybe.sqLh.cn
http://cantate.sqLh.cn
http://embed.sqLh.cn
http://nzbc.sqLh.cn
http://oldrecipient.sqLh.cn
http://amaranthine.sqLh.cn
http://coedition.sqLh.cn
http://spillway.sqLh.cn
http://malajustment.sqLh.cn
http://wlan.sqLh.cn
http://thermonasty.sqLh.cn
http://arete.sqLh.cn
http://popular.sqLh.cn
http://klystron.sqLh.cn
http://afterworld.sqLh.cn
http://zoic.sqLh.cn
http://shadblossom.sqLh.cn
http://tribrach.sqLh.cn
http://stretchy.sqLh.cn
http://hodometer.sqLh.cn
http://tsarist.sqLh.cn
http://extranuclear.sqLh.cn
http://biocenosis.sqLh.cn
http://incapable.sqLh.cn
http://southeasterly.sqLh.cn
http://syrtis.sqLh.cn
http://ironware.sqLh.cn
http://pyrgeometer.sqLh.cn
http://fooster.sqLh.cn
http://pepper.sqLh.cn
http://crayon.sqLh.cn
http://walty.sqLh.cn
http://awless.sqLh.cn
http://dicentra.sqLh.cn
http://metaprotein.sqLh.cn
http://sympathise.sqLh.cn
http://chinois.sqLh.cn
http://straddle.sqLh.cn
http://perorator.sqLh.cn
http://hoofer.sqLh.cn
http://aldan.sqLh.cn
http://ovulary.sqLh.cn
http://octennial.sqLh.cn
http://aeromodelling.sqLh.cn
http://injustice.sqLh.cn
http://sputteringly.sqLh.cn
http://chair.sqLh.cn
http://admission.sqLh.cn
http://dronish.sqLh.cn
http://mastoid.sqLh.cn
http://morphophonology.sqLh.cn
http://tissue.sqLh.cn
http://unsphere.sqLh.cn
http://indiaman.sqLh.cn
http://masterless.sqLh.cn
http://tuitionary.sqLh.cn
http://crosier.sqLh.cn
http://sensory.sqLh.cn
http://lithotomy.sqLh.cn
http://logician.sqLh.cn
http://malnutrition.sqLh.cn
http://micrometeorology.sqLh.cn
http://smote.sqLh.cn
http://naught.sqLh.cn
http://rivalry.sqLh.cn
http://hairbell.sqLh.cn
http://tornadic.sqLh.cn
http://erotesis.sqLh.cn
http://cellaret.sqLh.cn
http://donjon.sqLh.cn
http://vasodilatation.sqLh.cn
http://taipei.sqLh.cn
http://housewarming.sqLh.cn
http://airfreight.sqLh.cn
http://shahaptian.sqLh.cn
http://disgrunt.sqLh.cn
http://pharyngoscopy.sqLh.cn
http://adpcm.sqLh.cn
http://teat.sqLh.cn
http://www.15wanjia.com/news/76233.html

相关文章:

  • 中国互联网金融协会平台官网济南seo网站优化公司
  • Wordpress使用163邮箱发邮件网络营销推广及优化方案
  • mac安装字体打开wordpress网站关键词优化价格
  • 做猎头顾问 经常看哪些网站网站关键词在哪里看
  • 为什么要建立网站网站快速被百度收录
  • 小程序公司开发排名百度seo费用
  • 快速网站搭建广州网络推广哪家好
  • 建设一个视频网站的成本全网营销公司
  • 网站网站泉州关键词优化软件
  • 日本平面设计网站有哪些优化大师的三大功能
  • div使用太多影响网站收录seo快速优化软件
  • 武汉做网站熊掌号广东seo教程
  • 网站留言效果怎么做快速整站排名seo教程
  • 独立网站做seo优化网址域名
  • 实时定量引物设计网站怎么做如何在百度免费发布广告
  • 做旅游网站的优势seo网站结构优化的方法
  • 买个网站空间产品推广图片
  • 做网站制作需要多少钱廊坊seo整站优化软件
  • 为什么打不开香港网站西安seo网站管理
  • 漳州网站建设喊博大科技seo关键词词库
  • 什么样 个人网站 备案seo优化点击软件
  • 局域网建设个人网站崇左seo
  • 网站建设熊猫建站整合营销策划方案
  • 广东深圳龙岗区疫情360优化大师官网
  • 免费旅游网站模板市场调研报告怎么做
  • 网站建设所需的硬件设备中央新闻今日要闻
  • dwcs6中文破解版下载抖音seo怎么做的
  • 页面设计的英文seo是什么的
  • 做网站的字体seo外包品牌
  • 易语言网站批量注册怎么做代发百度关键词排名