Found 177 Articles for JSP

How to use action in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

782 Views

The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action. There are two basic ways to use the setProperty action −You can use jsp:setProperty after, but outside of a jsp:useBean element, as given below − ... In this case, the jsp:setProperty is executed regardless of whether a new bean was instantiated or an existing bean was found.A second context in which jsp:setProperty can appear is inside the body of a jsp:useBean element, as given below − ... Here, the jsp:setProperty is executed only if ... Read More

How to write a comment in a JSP page?

Samual Sam
Updated on 30-Jul-2019 22:30:25

9K+ Views

JSP comment marks to text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out", a part of your JSP page.Following is the syntax of the JSP comments −Following example shows the JSP Comments − A Comment Test A Test of Comments The above code will generate the following result −A Test of CommentsThere ... Read More

How to use action in JSP?

George John
Updated on 30-Jul-2019 22:30:25

2K+ Views

The useBean action is quite versatile. It first searches for an existing object utilizing the id and scope variables. If an object is not found, it then tries to create the specified object.The simplest way to load a bean is as follows −Once a bean class is loaded, you can use jsp:setProperty and jsp:getProperty actions to modify and retrieve the bean properties.Following table lists out the attributes associated with the useBean action −Sr.No.Attribute & Description1classDesignates the full package name of the bean.2typeSpecifies the type of the variable that will refer to the object.3beanNameGives the name of the bean as specified ... Read More

How to print a date using JSP Expression?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

249 Views

Following example shows a JSP Expression printing date on the browser −           A Comment Test     Today's date: The above code will generate the following result −Today's date: 11-Sep-2010 21:24:25

How to write a JSP Expression?

Samual Sam
Updated on 30-Jul-2019 22:30:25

346 Views

A JSP expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file.Because the value of an expression is converted to a String, you can use an expression within a line of text, whether or not it is tagged with HTML, in a JSP file.The expression element can contain any expression that is valid according to the Java Language Specification but you cannot use a semicolon to end an expression.Following is the syntax of JSP Expression −You can write the XML equivalent of the above syntax as ... Read More

What is the difference between include action and include directive in JSP?

Chandu yadav
Updated on 30-Jul-2019 22:30:25

935 Views

include action lets you insert files into the page being generated. The syntax looks like this −Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested.

How to declare an object of a class using JSP declarations?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

890 Views

A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.Following is the syntax for JSP Declarations −You can write the XML equivalent of the above syntax as follows − code fragment Following is an example of Object declaration in JSP Declarations −

What are JSP declarations? In how many ways we can write JSP declarations?

Samual Sam
Updated on 30-Jul-2019 22:30:25

134 Views

A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.Following is the syntax for JSP Declarations −You can write the XML equivalent of the above syntax as follows − code fragment Following is an example for JSP Declarations −

What is the function of action in JSP?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

236 Views

This action lets you insert files into the page being generated. The syntax looks like this −Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested.Following table lists out the attributes associated with the include action −S.No.Attribute & Description1pageThe relative URL of the page to be included.2flushThe boolean attribute determines whether the included resource has its buffer flushed before it is included.ExampleLet us define the following two files (a)date.jsp and (b) main.jsp as follows −Following is the content of ... Read More

What is a scriptlet in JSP and what is its syntax?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

1K+ Views

A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language.Following is the syntax of Scriptlet −You can write the XML equivalent of the above syntax as follows − code fragment Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP −           Hello World               Hello World!      

Advertisements