RUVIDEO
Поделитесь видео 🙏

150 ServletContext Attribute how to send the data between two different web resource programs java

📁 Обучение 👁️ 17 📅 05.12.2023

java Web Application to understand ServletContext Attributes how to pass/send the data between two different web resource programs of java web application using ServletContext Attributes:
ServletContext Attributes:
(Third way : how to pass/send the data between two different web resource programs of java web application using ServletContext Attributes)
-----------------------------------------------------------------------

- ServletContext Object is one per java web application and it is resides in the global memory of the web appln.

- ServeltContext attributes allocates memory in Serlvet Context object and they are visible in all the web resource programs of java web application irrespective of the request , response object(either they are in chaining or not) they are using & irrespective of the browser window form which they are getting request. (either from same browser window or different browser windows)

- in this diagram ServletContext object and servletcontext attributes are created in Srv1 Servlet Program is visible and accessible in all the web resource programs of java web appln without any condition / unconditionally.

- ServletContext attributes scope is application scope that means they are visible throught the web application across the multiple request.

- SevletContext object is also called as "Application" object so we can call ServletContext attributes as "Application attributes".

- To create ServletContext object, attributes:
-----------------------------------------------
ServletContext sc=getServletContext(); //gets access to servletContext object
sc.setAttribute("email","[email protected]");
sc.setAttribute("age",29);

- To modify ServletContext attributes:
--------------------------------------
sc.setAttribute("email","[email protected]");
sc.setAttribute("age",60);

- To read/access ServletContext attributes:
-----------------------------------------
String m=(String)sc.getAttribute("email");
int ageVal=(Integer)sc.getAttribute("age");

- To remove ServletContext attributes:
--------------------------------------
sc.removeAttribute("email");
sc.removeAttribute("age");


Example java Web Application to understand ServletContext Attributes how to pass/send the data between two different web resource programs of java web application using ServletContext Attributes:
------------------------------------------------------------------------

51ServletContextScopeAttribute: (DDS)
------------------------
|
|-----WEB-INF
|--------web.xml
|--------classes
|--------Srv1.java
|--------Srv2.java
|--------Srv3.java
|--------Srv4.java
|--------*.class

Compile all the servlets

Deploy the 51ServletContextScopeAttribute web appln in tomcat server (Copy & Paste 51ServletContextScopeAttribute folder to webapp folder of tomcat)

- Start the Tomcat Server

- Test the web application (Browser Window)
http://localhost:2020/51ServletContextScopeAttribute/s4url

http://localhost:2020/51ServletContextScopeAttribute/s1url
http://localhost:2020/51ServletContextScopeAttribute/s2url
http://localhost:2020/51ServletContextScopeAttribute/s3url


Do Observe the output.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «150 ServletContext Attribute how to send the data between two different web resource programs java», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.