Found 9326 Articles for Object Oriented Programming

How to apply forTokens tag in JSP?

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

161 Views

The tag has similar attributes as that of the tag except for one additional attribute delims which specifies characters to use as delimiters.AttributeDescriptionRequiredDefaultdelimsCharacters to use as delimitersYesNoneExample for           Tag Example                               The above code will generate the following result −Zara nuha roshy

How to apply forEach tag in JSP?

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

610 Views

The tag is a commonly used tag because it iterates over a collection of objects. The tag is used to break a string into tokens and iterate through each of the tokens.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultitemsInformation to loop overNoNonebeginElement to start with (0 = first item, 1 = second item, ...)No0endElement to end with (0 = first item, 1 = second item, ...)NoLast elementstepProcess every step itemsNo1varName of the variable to expose the current itemNoNonevarStatusName of the variable to expose the loop statusNoNoneExample for Tag Example Item The above code will generate the following result −Item 1 Item 2 Item 3 Item 4 Item 5

How to apply choose tag in JSP?

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

219 Views

The works like a Java switch statement in that it lets you choose between a number of alternatives. Where the switch statement has case statements, the tag has tags. Just as a switch statement has the default clause to specify a default action, has as the default clause.AttributeThe tag does not have any attribute.The tag has one attributes which is listed below.The tag does not have any attribute.The tag has the following attributes −AttributeDescriptionRequiredDefaulttestCondition to evaluateYesNoneExample           Tag Example             ... Read More

How to apply if tag in JSP?

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

193 Views

The tag evaluates an expression and displays its body content only if the expression evaluates to true.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaulttestCondition to evaluateYesNonevarName of the variable to store the condition's resultNoNonescopeScope of the variable to store the condition's resultNopageExample Tag Example My salary is: The above code will generate the following result −My salary is: 4000

How to handle an exception in JSP?

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

166 Views

The tag catches any Throwable that occurs in its body and optionally exposes it. It is used for error handling and to deal more gracefully with the problem.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultvarThe name of the variable to hold the java.lang.Throwable if thrown by elements in the body.NoNoneExample           Tag Example                                              The exception is : ${catchException}          There is an exception: ${catchException.message}       The above code will generate the following result −The exception is : java.lang.ArithmaticException: / by zero There is an exception: / by zero

How to remove a java variable from current scope in JSP?

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

363 Views

The tag removes a variable from either a specified scope or the first scope where the variable is found (if no scope is specified). This action is not particularly helpful, but it can aid in ensuring that a JSP cleans up any scoped resources it is responsible for.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultvarName of the variable to removeYesNonescopeScope of the variable to removeNoAll scopesExample           Tag Example           Before Remove Value: After Remove Value: The above code will generate the following result −Before Remove Value: 4000 After Remove Value:

How to set result of a java expression in a property in JSP?

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

112 Views

The tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java.util.Map object.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueInformation to saveNobodytargetName of the variable whose property should be modifiedNoNonepropertyProperty to modifyNoNonevarName of the variable to store informationNoNonescopeScope of variable to store informationNoPageIf target is specified, property must also be specified.Example Tag Example The above code will generate the following result −4000

How to print result of a java expression in JSP?

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

2K+ Views

The tag displays the result of an expression. This is almost similar to the way works. The difference here is that tag lets you use the simpler "." notation to access properties. For example, to access customer.address.street, use the tag  .The tag can automatically escape XML tags so they aren't evaluated as actual tags.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueInformation to outputYesNonedefaultFallback information to outputNobodyescapeXmlTrue if the tag should escape special XML charactersNotrueExample Tag Example The above code will generate the following result − , &

What the different types of JSTL tags are ?

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

513 Views

The JSTL tags can be classified, according to their functions, into the following JSTL tag library groups that can be used when creating a JSP page −Core TagsFormatting tagsSQL tagsXML tagsJSTL Functions

What is JSTL?

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

953 Views

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP applications.JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating the existing custom tags with the JSTL tags.Install JSTL LibraryTo begin working with JSP pages you need to first install the JSTL library. If you are using the Apache Tomcat container, then follow these two steps −Step 1 − Download the binary distribution from Apache Standard Taglib and ... Read More

Advertisements