
549 So.2d 751 (1989)
Donna POSIGIAN, Appellant,
v.
AMERICAN RELIANCE INSURANCE COMPANY OF NEW JERSEY, Appellee.
No. 88-2836.
District Court of Appeal of Florida, Third District.
October 3, 1989.
*752 Frank B. Pridgen, Miami, for appellant.
Lee Schulte and Murphy, and Peter H. Murphy, Coral Gables, for appellee.
Before NESBITT, COPE and GERSTEN, JJ.
GERSTEN, Judge.
Appellant Donna Posigian appeals a final order dismissing her complaint with prejudice against appellee American Reliance Insurance Company. We affirm.
In the lower court action, Posigian sued American Reliance Insurance Company (American Reliance) seeking insurance coverage for a consent judgment that Posigian had entered into with American Reliance's insured, Joseph Levinson. Posigian obtained the consent judgment in a previous action, in which Posigian had sued Levinson and Levinson's insurer, American Reliance for damages arising from an intentional assault and battery.
Levinson's policy with American Reliance excluded coverage for intentional acts of the insured. Based on this exclusion in the policy, American Reliance declined to defend Levinson in the lawsuit. American Reliance also informed Posigian that there was no coverage under the policy for the acts complained of in Posigian's complaint against Levinson. American Reliance then sought and obtained its dismissal from the action under the nonjoinder statute.
Shortly thereafter, Posigian entered into a consent judgment with Levinson in the amount of $50,000.00. The consent judgment stated that Levinson had acted in a "negligent" manner toward Posigian and that Posigian would only look toward Levinson's insurer for payment of the judgment.[1]
Posigian then brought suit against American Reliance in the underlying action to enforce the consent judgment. Attached to Posigian's complaint was a copy of the consent judgment and the declarations page of Levinson's policy with American Reliance.
American Reliance moved to dismiss Posigian's complaint for failure to attach a copy of her complaint in the previous action and for failure to attach a copy of American Reliance's policy of insurance. American Reliance also sought dismissal on the ground that the consent judgment was tainted by fraud and collusion and that its policy excluded coverage for intentional acts of the insured.
In support of its motion to dismiss, American Reliance attached a copy of the policy and a copy of the complaint Posigian had filed against Levinson. The trial court dismissed Posigian's complaint with prejudice and this appeal ensued.
Posigian raises three primary contentions on appeal. First, Posigian contends *753 the trial court erred in considering the insurance policy and the complaint filed in the other action in ordering the dismissal of her complaint. Second, Posigian argues the trial court improperly considered American Reliance's affirmative defense of an exclusion under the policy. Third, Posigian asserts the trial court erred in dismissing her complaint with prejudice without giving her an opportunity to amend.
We first conclude the trial court properly considered the insurance policy and the complaint filed in the other action in dismissing the action. Posigian's complaint against American Reliance made specific reference to these documents. The declarations page of the policy was, in fact, attached to the complaint and the complaint stated the policy was attached. The complaint also stated that a civil action had been brought against Levinson, a consent judgment obtained, and provided the case number for such action. In considering a motion to dismiss, "the trial court and this court are confined exclusively to an examination of the complaint and any attached documents incorporated therein." Hopke v. O'Byrne, 148 So.2d 755 (Fla. 1st DCA 1963); see Woolzy v. Government Employees Insurance Company, 360 So.2d 1153 (Fla. 3d DCA 1978); Harry Pepper & Associates, Inc. v. Lasseter, 247 So.2d 736 (Fla. 3d DCA 1971). Further, a court may take judicial notice of a record filed in another case, where the judgment in such case is pleaded. Leatherman v. Alta Cliff Co., 114 Fla. 305, 153 So. 845 (1934).
In addition, it was incumbent upon Posigian to provide the trial court with a copy of the policy and of the complaint filed in the other action. "The duty of an insurance carrier to defend a claim depends solely upon the allegations in the complaint filed against the insured." Patriot General Insurance Company v. Automobile Sales, Inc., 372 So.2d 187, 188 (Fla. 3d DCA 1979); National Union Fire Insurance Company v. Lenox Liquors, Inc., 358 So.2d 533 (Fla. 1977); Reliance Insurance Company v. Royal Motorcar Corporation, 534 So.2d 922 (Fla. 4th DCA 1988), review denied, 544 So.2d 200 (Fla. 1989); Federal Insurance Company v. Applestein, 377 So.2d 229 (Fla. 3d DCA 1979). "No obligation to defend the action, much less to pay any resulting judgment, arises when the pleading in question shows either the non-existence of coverage or the applicability of a policy exclusion." Federal Insurance Company v. Applestein, 377 So.2d at 231; see National Union Fire Insurance Company v. Lenox Liquors, Inc., 358 So.2d at 535-536; Reliance Insurance Company v. Royal Motorcar Corporation, 534 So.2d at 923. Rule 1.130(a), Florida Rules of Civil Procedure, requires that all documents upon which an action is brought "be incorporated in or attached to the pleading." The trial court's consideration of these documents was, therefore, correct.
We next conclude that American Reliance's defense of an exclusion under the policy was properly considered by the trial court. Rule 1.110(d), Florida Rules of Civil Procedure, permits a motion to dismiss to be based on an affirmative defense when the grounds therefore appear on the face of a prior pleading.[2]See also Stern v. First National Bank of South Miami, 275 So.2d 58 (Fla. 3d DCA 1973). American Reliance's defense of an exclusion under the policy appears on the face of Posigian's complaint, since her complaint incorporated the policy by reference and a part of the policy was attached to her complaint.
Finally, with respect to Posigian's third contention, we hold the dismissal with prejudice was correct. The complaint filed against Levinson for an intentional assault and battery and the exclusion in the policy for intentional conduct establish as a matter of law, that Posigian was incapable of stating a cause of action for enforcement of the judgment against American Reliance. See National Union Fire Insurance Company v. Lenox Liquors, Inc., 358 So.2d at 533; Reliance Insurance Company v. Royal Motorcar Corporation, 534 So.2d at 923; Federal Insurance Company *754 v. Applestein, 377 So.2d at 229. It would have been an exercise in futility to give Posigian an opportunity to amend her complaint. Where a complaint cannot be amended so as to state a cause of action, a dismissal with prejudice is proper. See Hansen v. Central Adjustment Bureau, Incorporated, 348 So.2d 608 (Fla. 4th DCA 1977); Weitzel v. State, 306 So.2d 188 (Fla. 1st DCA 1974), dismissed, 322 So.2d 922 (Fla. 1975). Having found the other contentions raised by Posigian to be without merit, the final order of dismissal is affirmed.
NESBITT, J., concurs.
COPE, Judge (dissenting).
I respectfully dissent. It was impermissible for the trial court, on a motion to dismiss, to consider matters outside of the complaint and exhibits thereto. Temples v. Florida Indus. Constr. Co., 310 So.2d 326, 327 (Fla. 2d DCA 1975). Even if dismissal were proper, denial of leave to amend was not. See Conklin v. Cohen, 287 So.2d 56, 60 (Fla. 1973). The dismissal with prejudice should be reversed, without prejudice to appellee's filing of an appropriate motion for summary judgment.
NOTES
[1]  We feel compelled to point out the amazing transformation from what was previously alleged in Posigian's complaint to be an intentional act by Levinson, changed, in the consent judgment, to a negligent act by Levinson.
[2]  An insurer's defense to suit because of an exclusion in its policy is an affirmative defense. Peninsular Life Insurance Company v. Hanratty, 281 So.2d 609 (Fla. 3d DCA 1973).
