- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use Action in JSP?
The plugin action is used to insert Java components into a JSP page. It determines the type of browser and inserts the <object> or <embed> tags as needed.
If the needed plugin is not present, it downloads the plugin and then executes the Java component. The Java component can be either an Applet or a JavaBean.
The plugin action has several attributes that correspond to common HTML tags used to format Java components. The <param> element can also be used to send parameters to the Applet or Bean.
Following is the typical syntax of using the plugin action −
<jsp:plugin type = "applet" codebase = "dirname" code = "MyApplet.class" width = "60" height = "80"> <jsp:param name = "fontcolor" value = "red" /> <jsp:param name = "background" value = "black" /> <jsp:fallback> Unable to initialize Java Plugin </jsp:fallback> </jsp:plugin>
You can try this action using some applet if you are interested. A new element, the <fallback> element, can be used to specify an error string to be sent to the user in case the component fails.
The <jsp:element> Action The <jsp:attribute> Action The <jsp:body> Action
The <jsp:element>, <jsp:attribute> and <jsp:body> actions are used to define XML elements dynamically. The word dynamically is important, because it means that the XML elements can be generated at request time rather than statically at compile time.
Following is a simple example to define XML elements dynamically −
<%@page language = "java" contentType = "text/html"%> <html xmlns = "http://www.w3c.org/1999/xhtml" xmlns:jsp = "http://java.sun.com/JSP/Page"> <head><title>Generate XML Element</title></head> <body> <jsp:element name = "xmlElement"> <jsp:attribute name = "xmlElementAttr"> Value for the attribute </jsp:attribute> <jsp:body> Body for XML element </jsp:body> </jsp:element> </body> </html>
This would produce the following HTML code at run time −
<html xmlns = "http://www.w3c.org/1999/xhtml" xmlns:jsp = "http://java.sun.com/JSP/Page"> <head><title>Generate XML Element</title></head> <body> <xmlElement xmlElementAttr = "Value for the attribute"> Body for XML element </xmlElement> </body> </html>
- Related Articles
- How to use action in JSP?
- How to use action in JSP?
- How to use action in JSP?
- How to use Action in JSP?
- What is the use of Action in JSP?
- What is the use of jsp plugin action element?
- What is the use of jsp text action element?
- How to use a filter in JSP?
- How to use resource bundle in JSP?
- What are the different scope values for the JSP action in JSP?
- How to use time zone in a JSP?
- What is the function of action in JSP?
- How to use action up event in android?
- How to use action move event in android?
- How to use action down event in android?
