Académique Documents
Professionnel Documents
Culture Documents
Any entity that has state and behavior is known as an object. For example: chair,
pen, table, keyboard, bike etc. It can be physical and logical.
When one object acquires all the properties and behaviors of parent
object i.e. known as inheritance. It provides code reusability. It is used to achieve
runtime polymorphism.
If there is any private, final or static method in a class, there is static binding.
When type of the object is determined at run-time, it is known as dynamic
binding.
A final variable that is not initialized at the time of declaration is known as blank
final variable.
A static final variable that is not initialized at the time of declaration is known as
static blank final variable. It can be initialized only in static block.
Overriding:
If any method is not visible in child class, if we create same method for overriding
it creates as new method.
We cannot override private methods, by accessing super class reference it gives not visible
CTE
Replacing private to default, protected, public it works fine with in package, outside
package default wont work.
Levels of access modifiers for overriding
Public Protected Default Private
By declaring super class method as static and child class as non-static it throws CTE This
instance method cannot override the static method from Super
If interface method throws any Exception its not mandatory to throw in an implemented
method, if implemented class method throws any exception its mandatory to have it in
interface method.
Collections:
Collections.sort(list);
External Sorting:
This order was placed for QT3000 OK , without ^ it prints other than a-z0-9
There are many immutable classes like String, Boolean, Byte, Short, Integer, Long,
Float, Double etc. In short, all the wrapper classes and String class is immutable.
We can also create immutable class by creating final class that have final data
members
A class that is declared with abstract keyword is known as abstract class in java. It
can have abstract and non-abstract methods (method with body).
By static import, we can access the static members of a class directly, there is no
to qualify it with the class name.
The purpose of the Runtime class is to provide access to the Java runtime system.
Wrapper classes are classes that allow primitive types to be accessed as objects.
Multithreading
sleep (): It is a static method on Thread class. It makes the current thread into the
"Not Runnable" state for specified amount of time. During this time, the thread
keeps the lock (monitors) it has acquired.
wait(): It is a method on Object class. It makes the current thread into the "Not
Runnable" state. Wait is called on a object, not a thread. Before calling wait()
method, the object should be synchronized, means the object should be inside
synchronized block. The call to wait() releases the acquired lock
The join() method waits for a thread to die. In other words, it causes the currently
running threads to stop executing until the thread it joins with completes its task.
The non-static join () method of class Thread lets one thread "join onto the end" of
another thread. If you have a thread B that can't do its work until another thread A
has completed its work, then you want thread B to "join" thread A. This means that
thread B will not become runnable until A has finished (and entered the dead
state).
By using notify we can notify only one thread which is first went in to waiting state
By using notify all we can notify all threads which are in waiting state
The notify() is used to unblock one waiting thread whereas notifyAll() method is
used to unblock all the threads in waiting state.
If you make any static method as synchronized, the lock will be on the class not on
object.
Deadlock:
Deadlock is a situation when two threads are waiting on each other to release a
resource. Each thread waiting for a resource which is held by the other waiting
thread.
Exception
Throw keyword is used to throw the exception manually. It is mainly used when
the program fails to satisfy the given condition and it wants to warn the
application.
Throws: When we are throwing any checked exception in a method and not
handling it, then we need to use throws keyword in method signature to let caller
program know the exceptions that might be thrown by the method. The caller
method might handle these exceptions or propagate it to its caller method using
throws keyword. We can provide multiple exceptions in the throws clause and it
can be used with main() method also.
NoClassDefFoundError: This is more difficult to debug and find the reason. This
is thrown when at compile time the required classes are present, but at run time
the classes are changed or removed or class's static initializes threw exceptions. It
means the class which is getting loaded is present in classpath, but one of the
classes which are required by this class, are either removed or failed to load by
compiler .So you should see the classes which are dependent on this class.
Now after compiling both the classes, if you delete Test1.class file, and run Test
class, it will throw
No. The static variables belong to the class are not the part of the state of the
object so they are not saved as the part of serialized object.
When an object of a class is serialized, the class name and serial version UID are
written to the stream of bytes. When it's deserialized, the JVM checks if the serial
version UID read from the stream of bytes is the same as the one of the local class.
If they're not, it doesn't even try to deserialize the object, because it knows the
classes are incompatible.
ConcurrentHashMap:
o ConcurrentHashMap allows concurrent read and thread-safe update
operation.
o During update operation, ConcurrentHashMap only lock a portion of Map
instead of whole Map.
o Concurrent update is achieved by internally dividing Map into small portion
which is defined by concurrency level.
o Choose concurrency level carefully as a significant higher number can be
waste of time and space and lower number may introduce thread contention
in case writers over number concurrency level.
o All operations of ConcurrentHashMap are thread-safe.
o Since ConcurrentHashMap implementation doesn't lock whole Map, there is
chance of read overlapping with update operations like put() and remove().
In that case result returned by get() method will reflect most recently
completed operation from there start.
o Iterator returned by ConcurrentHashMap is weekly consistent, fail safe and
never throw ConcurrentModificationException. In Java.
o ConcurrentHashMap doesn't allow null as key or value.
o You can use ConcurrentHashMap in place of Hashtable but with caution as
CHM doesn't lock whole Map.
o During putAll() and clear() operations, concurrent read may only reflect
insertion or deletion of some entries.
putIfAbsent(key, value)
Design Patterns
Factory method: The method which is returning its own class object is called
factory method design pattern
Delegate class is responsible for getting the business service object and to provide
access to Business Service methods.
The service locator design pattern is used when we want to locate various
services using JNDI lookup. Considering high cost of looking up JNDI for a service,
Service Locator pattern makes use of caching technique. For the first time a
service is required, Service Locator looks up in JNDI and caches the service object.
Further lookup or same service via Service Locator is done in its cache which
improves the performance of application to great extent.
The Transfer Object pattern (DTO) is used when we want to pass data with
multiple attributes in one shot from client to server. Transfer object is also known
as Value Object. Transfer Object is a simple POJO class having getter/setter
methods and is serializable so that it can be transferred over the network. It does
not have any behavior. Server Side business class normally fetches data from the
database and fills the POJO and send it to the client or pass it by value. For client,
transfer object is read-only. Client can create its own transfer object and pass it to
server to update values in database in one shot. Following are the entities of this
type of design pattern.
Data Access Object Pattern or DAO pattern is used to separate low level data
accessing API or operations from high level business services.
Facade pattern hides the complexities of the system and provides an interface to
the client using which the client can access the system.
This pattern involves a single class which provides simplified methods required by
client and delegates calls to methods of existing system classes.
Hibernate
Inheritance:
Hibernate uses Reflection API to create instance of Entity beans, usually when you
call get() or load() methods. The method Class.newInstance() is used for this and
it requires no-args constructor. So if you wont have no-args constructor in entity
beans, hibernate will fail to instantiate it and you will get HibernateException
Ordered list is better than sorted list because the actual sorting is done at
database level, that is fast and doesnt cause memory issues.
There are five collection types in hibernate used for one-to-many relationship
mappings Bag, Set, List, Array, Map.
Making Entity Class final: Hibernate use proxy classes for lazy loading of data,
only when its needed. This is done by extending the entity bean, if the entity bean
will be final then lazy loading will not be possible, hence low performance.
Hibernate implements a cache region for queries resultset that integrates closely
with the hibernate second-level cache.
Native SQL Query comes handy when we want to execute database specific
queries that are not supported by Hibernate API such as query hints or the
CONNECT keyword in Oracle Database.
Hibernate provides Named Query that we can define at a central location and
use them anywhere in the code. We can created named queries for both HQL and
Native SQL. Disadvantage hard to debug.
Hibernate provides Criteria API that is more object oriented for querying the
database and getting results. We cant use Criteria to run update or delete queries
or any DDL statements. Its only used to fetch the results from the database using
more object oriented approach.
Criteria API provides Projection that we can use for aggregate functions such
as sum(), min(), max() etc.
Criteria API can be used with ProjectionList to fetch selected columns only.
Criteria API can be used for join queries by joining multiple tables, useful
methods are createAlias(), setFetchMode() and setProjection()
Criteria API can be used for fetching results with conditions, useful methods
are add() where we can add Restrictions.
Criteria API provides addOrder() method that we can use for ordering the
results.
Hibernate uses proxy object to support lazy loading. Basically when you load
data from tables, hibernate doesnt load all the mapped objects. As soon as you
reference a child or lookup object via getter methods, if the linked entity is not in
the session cache, then the proxy code will go to the database and load the linked
object. It uses javassist to effectively and dynamically generate sub-classed
implementations of your entity objects.
Cascading Types:
None: No Cascading, its not a type but when we dont define any cascading
then no operations in parent affects the child.
ALL: Cascades save, delete, update, evict, lock, replicate, merge, persist.
Basically everything
SAVE_UPDATE: Cascades save and update, available only in hibernate.
DELETE: Corresponds to the Hibernate native DELETE action, only in
hibernate.
DETATCH, MERGE, PERSIST, REFRESH and REMOVE for similar operations
LOCK: Corresponds to the Hibernate native LOCK action.
REPLICATE: Corresponds to the Hibernate native REPLICATE action.
When Spring and Hibernate integration started, Spring ORM provided two helper
classes HibernateDaoSupport and HibernateTemplate. The reason to use them was
to get the Session from Hibernate and get the benefit of Spring transaction
management. However from Hibernate 3.0.1, we can use SessionFactory
getCurrentSession() method to get the current session and use it to get the spring
transaction management benefits. If you go through above examples, you will see
how easy it is and thats why we should not use these classes anymore.
One other benefit of HibernateTemplate was exception translation but that can be
achieved easily by using @Repository annotation with service classes, shown in
above spring mvc example. This is a trick question to judge your knowledge and
whether you are aware of recent developments or not.
Key Points:
Always check the primary key field access, if its generated at the database
layer then you should not have a setter for this.
By default hibernate set the field values directly, without using setters. So if
you want hibernate to use setters, then make sure proper access is defined
as @Access(value=AccessType.PROPERTY).
If access type is property, make sure annotations are used with getter
methods and not setter methods. Avoid mixing of using annotations on both
filed and getter methods.
Use native sql query only when it cant be done using HQL, such as using
database specific feature.
If you have to sort the collection, use ordered list rather than sorting it using
Collection API.
Use named queries wisely, keep it at a single place for easy debugging. Use
them for commonly used queries only. For entity specific query, you can
keep them in the entity bean itself.
For web applications, always try to use JNDI DataSource rather than
configuring to create connection in hibernate.
Avoid Many-to-Many relationships, it can be easily implemented using
bidirectional One-to-Many and Many-to-One relationships.
For collections, try to use Lists, maps and sets. Avoid array because you
dont get benefit of lazy loading.
Do not treat exceptions as recoverable, roll back the Transaction and close
the Session. If you do not do this, Hibernate cannot guarantee that in-
memory state accurately represents the persistent state.
Prefer DAO pattern for exposing the different methods that can be used with
entity bean
Prefer lazy fetching for associations
Fetching Strategies:
There are four fetching strategies
1. fetch-join = Disable the lazy loading, always load all the collections and
entities.
2. fetch-select (default) = Lazy load all the collections and entities.
3. batch-size=N = Fetching up to N collections or entities, *Not record*.
4. fetch-subselect = Group its collection into a sub select statement.
fetch=select or @Fetch(FetchMode.SELECT)
This is the default fetching strategy. it enabled the lazy loading of all its related
collections.
Get parent data, while accessing get on child , for each parent data get child data
fetch=join or @Fetch(FetchMode.JOIN)
The join fetching strategy will disabled the lazy loading of all its related
collections.
Gets parent and child data using single query.
batch-size=10 or @BatchSize(size = 10)
It fetches parent records, and for child it gets based on size i.e, in (?,?,?) passing id
of parent
fetch=subselect or @Fetch(FetchMode.SUBSELECT)
This fetching strategy is enable all its related collection in a sub select statement
Multiple place projection in setProjection, for one column return is column type,
multiple Object array
Hibernate Save
As the method name suggests, hibernate save() can be used to save entity to
database. We can invoke this method outside a transaction, thats why I dont like
this method to save data. If we use this without transaction and we have
cascading between entities, then only the primary entity gets saved unless we
flush the session.
Hibernate Persist
Hibernate persist is similar to save (with transaction) and it adds the entity
object to the persistent context, so any further changes are tracked. If the
object properties are changed before the transaction is committed or session is
flushed, it will also be saved into database.
Second difference is that we can use persist() method only within the boundary of
a transaction, so its safe and takes care of any cascaded objects.
Finally, persist doesnt return anything so we need to use the persisted object to
get the generated identifier value. Lets look at hibernate persist with a simple
program.
Hibernate saveOrUpdate
Hibernate saveOrUpdate results into insert or update queries based on the
provided data. If the data is present in the database, update query is executed.
We can use saveOrUpdate() without transaction also, but again you will face the
issues with mapped objects not getting saved if session is not flushed.
One important difference between save and saveOrUpdate is that it adds the
entity object to persistent context and track any further changes. Any further
changes are saved at the time of committing transaction, like persist.
Hibernate Merge
Hibernate merge can be used to update existing values, however this method
create a copy from the passed entity object and return it. The returned object is
part of persistent context and tracked for any changes, passed object is not
tracked. This is the major difference with merge() from all other methods. Lets
look at this with a simple program.
Spring
As the name implies Inversion of control means now we have inverted the control
of creating the object from our own using new operator to container or framework.
Now its the responsibility of container to create object as required.
Constructor Injection:
Inheriting Bean:
By using the parent attribute of bean, we can specify the inheritance relation
between the beans. In such case, parent bean values will be inherited to the
current bean.
Setter Injection:
There are many key differences between constructor injection and setter injection.
1. Partial dependency: can be injected using setter injection but it is not possible by
constructor. Suppose there are 3 properties in a class, having 3 arg constructor and
setters methods. In such case, if you want to pass information for only one property,
it is possible by setter method only.
2. Overriding: Setter injection overrides the constructor injection. If we use both
constructor and setter injection, IOC container will use the setter injection.
3. Changes: We can easily change the value by setter injection. It doesn't create a
new bean instance always like constructor. So setter injection is flexible than
constructor injection.
Autowiring can't be used to inject primitive and string values. It works with
reference only.
By using @Transactional, Spring manages transactions declaratively.
Methods are annotated with @Transactional , the Spring Hibernate transaction
manager creates the required transactions and the respective sessions.
Spring MVC:
The Model encapsulates the application data and in general they will consist of
POJO.
The View is responsible for rendering the model data and in general it generates
HTML output that the client's browser can interpret.
The Controller is responsible for processing user requests and building
appropriate model and passes it to the view for rendering.
The @Controller annotation defines the class as a Spring MVC controller. Here,
the first usage of @RequestMapping indicates that all handling methods on this
controller are relative to the /hello path. Next annotation
@RequestMapping(method = RequestMethod.GET) is used to declare the
printHello() method as the controller's default service method to handle HTTP GET
request. You can define another method to handle any POST request at the same
URL.
The value attribute indicates the URL to which the handler method is mapped and
the method attribute defines the service method to handle HTTP GET request.
annotation @ResponseBody, which tells Spring MVC that the String returned by
the method is the response to the request, it does not have to find view for this
string. So the retuning String will be send back to the browser as response and
hence the Ajax request will work.
JUnit:
Programmatic transaction management: This means that you have
manage the transaction with the help of programming. That gives you
extreme flexibility, but it is difficult to maintain.
AOP:
Join point
Join point is any point in your program such as method execution, exception
handling, field access etc. Spring supports only method execution join point.
Advice
Advice represents an action taken by an aspect at a particular join point. There are
different types of advices:
Introduction
It means introduction of additional method and fields for a type. It allows you to
introduce new interface to any advised object.
Target Object
It is the object i.e. being advised by one or more aspects. It is also known as
proxied object in spring because Spring AOP is implemented using runtime proxies.
Aspect
It is a class that contains advices, joinpoints etc.
Interceptor
It is an aspect that contains only one advice.
AOP Proxy
It is used to implement aspect contracts, created by AOP framework. It will be a
JDK dynamic proxy or CGLIB proxy in spring framework.
Weaving
It is the process of linking aspect with other application types or objects to create
an advised object. Weaving can be done at compile time, load time or runtime.
Spring AOP performs weaving at runtime.
Web services are client and server applications that communicate over the
world wide webs HTTP
By using web services, applications can publish its functions to the rest of
the world.
Web services uses xml to code and to decode data, and SOAP to transport it
(using open protocols)
WSDL:
WSDL Elements:
Types: It describes the data types used by the web services. Data types are
usually specified by XML Schema
Interface: It describes the operations available in the Web service i.e. methods
Service: It describes the endpoint of Web service & the address where the web
service can be reached
Message: It describes the data being exchanged between the web service
providers and consumers
If the industry published an UDDI standard for flight rate checking and
reservation, airlines could register their services into an UDDI directory. Travel
agencies could then search the UDDI directory to find the airline's reservation
interface. When the interface is found, the travel agency can communicate with
the service immediately because it uses a well-defined reservation interface.
2. <wsdl:definitions targetNamespace="http://webservices.javapostsforlearning.arpit.org" xm
lns:apachesoap="http://xml.apache.org/xml-soap" xmlns:imp
l="http://webservices.javapostsforlearning.arpit.org" xmlns:intf="http://webservices.javapost
sforlearning.arpit.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="htt
p://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
5. <wsdl:types>
7. <element name="sayHelloWorld">
8. <complexType>
9. <sequence>
11. </sequence>
12. </complexType>
13. </element>
15. <complexType>
16. <sequence>
18. </sequence>
19. </complexType>
20. </element>
21. </schema>
22. </wsdl:types>
25. </wsdl:message>
28. </wsdl:message>
33. </wsdl:operation>
34. </wsdl:portType>
41. </wsdl:input>
44. </wsdl:output>
45. </wsdl:operation>
46. </wsdl:binding>
50. </wsdl:port>
51. </wsdl:service>
52. </wsdl:definitions>
Generating Web service client code by using maven:
Marshalling & UnMarshalling
Can we modify the header and body parts of SOAP messages so that
some common operations like logging can be performed?
This can be achieved by using interceptors which intercept the message before
sending and receiving it. An interceptor can be written on the client or server
side and perform its job as defined in the code. These interceptors are known as
handlers in JAX-WS specification. There are SOAPHandlers and LogicalHandlers
which can do different processing on the server side and client side.
REST fundamentals:
Uses uniform interfaces. Resources are handled using POST, GET, PUT,
DELETE operations which are similar to Create, Read, update and Delete
(CRUD) operations.
Security to Webservice:
Java: 1.6
Spring: 3.0.4
Hibernate: 3.3.1
JMS: 10.3
Maven: 3.0.3
Oracle
Outer Joins
Outer joins is divided into left outer joins, right outer joins, and full outer
joins.
select * from employee left outer join location on employee.empID =
location.empID;
or
select * from employee left join location on employee.empID =
location.empID;
Inner Joins
The difference between an inner join and an outer join is that an inner join
will return only the rows that actually match based on the join predicate.
Non-Equi Join:
A Non- Equi Join is a SQL Join where condition is established between table
using all comparison operators (>=, <=, <, >) can used except the equal
(=) .
Self Joins:
A self means joining columns of a table to itself. It fetches record from
same table only and for that we have to mention table alias name twice
times.
SELECT * FROM EMP E1, EMP E2 WHERE E1.EMPNO=E2.MGR
Outer-Join
Outer join returns all records from one table and those records from
another table where meets joining condition.
There are three types of outer joins
=>Left Outer-join
=>Right outer-join
=>Full outer-join
Full Outer-join
Full Outer-join is combination of left and right outer join.It returns both
match and unmatched row from both tables.
SELECT * FROM EMP FULL OUTER JOIN DEPT ON EMP.DEPTNO=DEPT.DEPTNO
SELECT * FROM EMP,DEPT EMP.DEPTNO(+)=DEPT.DEPTNO(+)
Anti Join
Suppose there are two tables A and B Anti-join between two tables A AND B
returns rows from the table A, for which there are no corresponding rows in
the Table B. Anti-join is also a sub-query in which parent query doesn't
depend upon child query. Example1:List deptno. Dept name for all the
departments in which there are no employees in the department.
SELECT * FROM DEPT D WHERE NOT EXIST (SELECT * FROM EMP E WHERE
D.DEPTNO = E.DEPTNO)
Example2:There are two tables Emp1 and Emp2. Fetch the record those are
present in Emp1 not in Emp2
SELECT * FROM EMP1 MINUS SELECT * FROM EMP2
Semi-join
between two tables returns rows from table A ,where one or more matches
are found in table B.It is kown as Co-Related-Sub-query, Where parent
query depents upon Child query.
Example1:There are two tables Emp1 and Emp2. Fetch the record common
in Emp1 and emp2.
SELECT * FROM EMP1 INTERSECT SELECT * FROM EMP2
Example2:Select records from emp and Dept where Deptno of Emp matches
Deptno in Dept
SELECT * FROM EMP WHERE EMP.DEPTNO IN(SELECT DEPTNO FROM DEPT)
Cross Join
Cross join jenerally generate cross product between two table. Each row of
Table1 ,combined with each rows of Table2.
HTML
HTML also has six levels of headings, which use the elements <h1>, <h2>,
<h3>, <h4>, <h5>, and <h6> Big to small
The <hr> tag creates a line from the current position in the document to the right
margin and breaks the line accordingly.
<pre>
function testFunction( strText ){
alert (strText)
}
</pre>
<b>bold</b> bold
<i>italicized</i> italicized
<u>underlined</u> underlined
<strike>strikethrough</strike> strikethrough
<tt>monospaced</tt> monospaced
<sup>superscript</sup> superscript
<sub>subscript</sub> subscript
<big>big</big> big
<small>small</small> small
<em>emphasized</em> emphasized
<mark>marked</mark> marked
<strong>strong</strong> strong
<abbr title="Abhishek">Abhy</abbr>
<bdo dir="rtl">This text will go right to left.</bdo></p> This text will go right to left.
The <div> and <span> elements allow you to group together several elements
to create sections or subsections of a page.
<ul> - An unordered list. This will list items using plain bullets.
<ol> - An ordered list. This will use different schemes of numbers to list your
items.
<dl> - A definition list. This arranges your items in the same way as they are
arranged in a dictionary.
<ul type="square">
<ul type="disc">
<ul type="circle">
<ul type="square">
<li>Beetroot</li> Beetroot
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
<ol type="1"> - Default-Case Numerals.
<ol type="I"> - Upper-Case Numerals.
<ol type="i"> - Lower-Case Numerals.
<ol type="a"> - Lower-Case Letters.
<ol type="A"> - Upper-Case Letters.
<a href="mailto:abc@example.com?subject=Feedback&body=Message">
Send Feedback
</a>
<frameset rows="10%,80%,10%">
<frame name="top" src="/html/top_frame.htm" />
<frame name="main" src="/html/main_frame.htm" />
<frame name="bottom" src="/html/bottom_frame.htm" />
<noframes>
<body>
Your browser does not support frames.
</body>
</noframes>
</frameset>
The <body> tag has following attributes which can be used to set different colors:
vlink - sets a color for visited links - that is, for linked text that you have already clicked
on.
The font tag is having three attributes called size, color, and face
CSS
Type selectors:
h1 {
color: #36CFFF;
}
Universal Selector:
*{
color: #000000;
}
Descendant selector:
Suppose you want to apply a style rule to a particular element only when it lies
inside a particular element.
ul em {
color: #000000;
}
Class selector:
.black {
color: #000000;
}
h1.black {
color: #000000;
}
ID Selector:
#elementid {
color: #000000;
}
h1# elementid {
color: #000000;
}
Child selectors:
body > p {
color: #000000;
}
Attribute Selector:
input[type="text"]{
color: #000000;
}
Embedded CSS:
<head>
<style type="text/css" media="..."> 2
Style Rules
............
</style>
</head>
Inline CSS:
<element style="...style rules...."> priority:1
External CSS:
<head>
<link type="text/css" href="..." media="..." /> 3
</head>
The background-repeat property is used to control the repetition of an image in the background.
The background-position property is used to control the position of an image in the background.
The background-attachment property is used to control the scrolling of an image in the background.
The background property is used as shorthand to specify a number of other background properties.
The font-weight property is used to increase or decrease how bold or light a font appears.
The letter-spacing property is used to add or subtract space between the letters
that make up a word.
<p style="letter-spacing:5px;">
This text is having space between letters.
</p>
The word-spacing property is used to add or subtract space between the words
of a sentence.
<p style="word-spacing:5px;">
This text is having space between words.
</p>
<p style="text-decoration:underline;">
This will be underlined
</p>
<p style="text-transform:capitalize;">
This will be capitalized
</p>
<style type="text/css">
a:link {color: #000000}
a:visited {color: #006600}
a:hover {color: #FFCC00}
a:active {color: #FF00CC}
</style>
<p style="visibility:hidden;">
This paragraph should not be visible.
</p>
<style type="text/css">
</style>
elements
<style tyle="text/css">
<!--
p { color: #000000; }
-->
</style>
Here you have made p { color: #ff0000 !important; } mandatory, now this rule will
always apply even you have defined another rule p { color: #000000; }
JAVA SCRIPT
Page redirect
window.location="http://www.newlocation.com";
print window.print();