AI & Machine Learning
Attributes in Servlet
Last updated on Jun 15, 2020
Copy Link:
Attributes in Servlet:
- A quality in servlet is a protest that can be set, get or expelled from one of the accompanying extensions request scope
- session scope
- application scope
The servlet software engineer can pass informations starting with one servlet then onto the next utilizing properties. It is much the same as passing item starting with one class then onto the next so we can reuse a similar question over and over.
Methods:
- public void setAttribute(String name,Object object)
- public Object getAttribute(String name)
- public Enumeration getInitParameterNames()
- public void removeAttribute(String name)
JAVA Tutorial Video
[embed]https://www.youtube.com/watch?v=zr1RxswTahU&t=642s [/embed] web.xml: <web-app> <servlet> <servlet-name>s1</servlet-name> <servlet-class>DemoServlet1</servlet-class> </servlet> <servlet-mapping> <servlet-name>s1</servlet-name> <url-pattern>/servlet1</url-pattern> </servlet-mapping> <servlet> <servlet-name>s2</servlet-name> <servlet-class>DemoServlet2</servlet-class> </servlet> <servlet-mapping> <servlet-name>s2</servlet-name> <url-pattern>/servlet2</url-pattern> </servlet-mapping> </web-app> Attributes :sets the given protest in the application scope.
open Object getAttribute(String name):Returns the trait for the predetermined name.
open Enumeration getInitParameterNames():Returns the names of the setting's introduction parameters as an Enumeration of String objects.
open void removeAttribute(String name):Removes the trait with the given name from the servlet setting.
