Found 4336 Articles for Java 8

What is the use of tag in JSP?

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

334 Views

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

298 Views

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

163 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

627 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

225 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

195 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

170 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

368 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

117 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 − , &

Advertisements