Found 177 Articles for JSP

What are JSTL formatting tags in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The JSTL formatting tags are used to format and display text, the date, the time, and numbers for internationalized Websites. Following is the syntax to include Formatting library in your JSP −Following table lists out the Formatting JSTL Tags −S.No.Tag & Description1: To render numerical value with specific precision or format.2: Parses the string representation of a number, currency, or percentage.3: Formats a date and/or time using the supplied styles and pattern.4: Parses the string representation of a date and/or time5: Loads a resource bundle to be used by its tag body.6: Stores the given locale in the locale configuration variable.7: Loads a resource bundle and ... Read More

What is the use of tag in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25
The tag formats a URL into a string and stores it into a variable. This tag automatically performs URL rewriting when necessary. The var attribute specifies the variable that will contain the formatted URL.The JSTL url tag is just an alternative method of writing the call to the response.encodeURL() method. The only real advantage the url tag provides is proper URL encoding, including any parameters specified by children param tag.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueBase URLYesNonecontext/ followed by the name of a local web applicationNoCurrent applicationvarName of the variable to expose the processed URLNoPrint to pagescopeScope of ... Read More

What is the use of tag in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The tag redirects the browser to an alternate URL by facilitating automatic URL rewriting, it supports context-relative URLs, and it also supports the tag.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaulturlURL to redirect the user's browser toYesNonecontext/ followed by the name of a local web applicationNoCurrent applicationExampleIf you need to pass parameters to a tag, use the tag to create the URL first as shown below − Tag Example The above code will redirect the request to http://www.photofuntoos.com - Try it yourself.

What is the use of tag in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25
The tag allows proper URL request parameter to be specified with URL and also does the necessary URL encoding required.Within a tag, the name attribute indicates the parameter name, and the value attribute indicates the parameter value −AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultnameName of the request parameter to set in the URLYesNonevalueValue of the request parameter to set in the URLNoBodyExampleIf you need to pass parameters to a tag, use the tag to create the URL first as shown below − The above request will ... Read More

How to apply forTokens tag in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
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
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
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
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
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
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:
Previous 1 ... 3 4 5 6 7 ... 18 Next
Advertisements