delivered the opinion of the court:
Plaintiff, Thomas V Ryburn, filed a complaint in mandamus against the State of Illinois and McLean County, seeking to have a conviction expunged. The McLean County circuit court dismissed the action, and Ryburn appeals. We vacate the judgment and dismiss the action on other grounds.
Ryburn is an inmate of the Illinois Department of Corrections. In his mandamus complaint, filed on May 13, 2002, without the aid of a lawyer, Ryburn sought to have his conviction in a 1994 case expunged. It appears from the record that Ryburn was already serving probation on a previous conviction when he was found guilty of domestic battery in 1994. Ryburn alleged that this second conviction was based on the testimony of his ex-wife, Lisa Ryburn, but that she later recanted that testimony.
In support of these allegations, Ryburn attached to his complaint two letters Lisa wrote to him. In a letter postmarked September 24, 1996, Lisa wrote, “I keep so busy so I don’t have time to think. Because when I think, I think about the fact your [sic] not here and my responsibility in that. *** I can’t believe I treated the other person who loved me more than his own life so badly.” In a second letter, undated, Lisa wrote, “I don’t like the person I become when I’m around you and that is not your fault and you have no control over that either.”
Ryburn also attached to his complaint a copy of an April 10, 1998, agreed order entered in the McLean County circuit court in the Ry-burns’ dissolution-of-marriage case. The order contained factual findings that he and Lisa had reconciled and planned to remarry and sought joint custody of their children. In addition, the order stated that Lisa “withdraws her allegations of abusive conduct by [Ryburn,] which she made in her complaint for order of protection.”
*992Ryburn’s mandamus complaint asked for the trial court to issue an order of mandamus ordering defendants (1) to expunge all of his “civil/crim. domestic history(s) from all record’s [sic]” and (2) to make a criminal investigation into what he “was subjected to physically/ mental/emotionally.” The complaint’s caption named the State and McLean County as defendants, and in the body it referred to “[defendant, Charles Reynard[,] and Sandra Parker, *** the Prosecutor/Record(s)keeper. ’ ’
The complaint languished after being filed with the McLean County clerk’s office and was never served on anyone. On July 23, 2002, Ryburn filed a motion for judgment on the pleadings. On August 29, 2002, the trial court sent a letter to the Illinois Attorney General’s office, enclosing Ryburn’s complaint and asking that the case be assigned to the appropriate person. McLean County has not been involved in this litigation.
On October 9, 2002, the State filed a motion to dismiss the action. This combined motion first asked the trial court to dismiss the lawsuit under section 2 — 615 of the Code of Civil Procedure (Code) (735 ILCS 5/2 — 615 (West 2002)) for failure to state a cause of action. Second, the State objected to personal jurisdiction under section 2 — 301 (735 ILCS 5/2 — 301 (West 2002)). The court held a hearing on the combined motion at which Ryburn was present. Without addressing the issue of personal jurisdiction, the court dismissed the action under section 2 — 615.
We begin our discussion by considering the issue of personal jurisdiction because “[i]t is essential to the validity of a judgment that the court have both jurisdiction of the subject matter of the litigation and jurisdiction over the parties.” State Bank of Lake Zurich v. Thill, 113 Ill. 2d 294, 308, 497 N.E.2d 1156, 1161 (1986). The trial court’s action, bypassing the jurisdiction issue in favor of dismissing the complaint for failure to state a cause of action, is inconsistent with this view.
There appear to be no Illinois cases addressing whether a court faced with a combined motion to dismiss under section 2 — 615 and objection to personal jurisdiction may choose to rule on the section 2 — 615 motion. The reason for this is simple: until January 1, 2000, such a combined motion waived the objection to jurisdiction. Under prior law, a defendant who wished to challenge the court’s jurisdiction would file a special appearance. 735 ILCS 5/2 — 301(a) (West 1998) (amended 2000). A special appearance was an appearance made for the “sole purpose” of objecting to the court’s jurisdiction (In re Marriage of Snider, 305 Ill. App. 3d 697, 699, 712 N.E.2d 947, 948 (1999)) and had to be made prior to filing any other pleading or motion. 735 *993ILCS 5/2 — 301(a) (West 1998) (amended 2000). Any appearance that was not a special appearance was deemed a general appearance (735 ILCS 5/2 — 301(a) (West 1998) (amended 2000)); by filing a general appearance, a defendant waived any objection to the court’s jurisdiction over the defendant (In re Estate of Loesch, 134 Ill. App. 3d 766, 769, 481 N.E.2d 32, 35 (1985)). A defendant who attempted to combine an objection to personal jurisdiction with another motion could inadvertently waive the objection because the combined motion would constitute a general appearance. See Mueller v. Mueller, 36 Ill. App. 2d 305, 307, 183 N.E.2d 887, 888-89 (1962).
The relevant section of the Code has been amended, and it now allows an objection to personal jurisdiction to be combined with certain other motions. 735 ILCS 5/2 — 301(a) (West 2002). The reason for this change was to prevent a defendant from accidentally waiving any objection to personal jurisdiction. K. Beyler, The Death of Special Appearances, 88 Ill. B.J. 30, 31 (2000). A combined motion no longer constitutes a general appearance but raises the new question of the order in which the trial court should decide the issues raised in the motion.
To begin with, it is clear that under current law the trial court faced with an objection to personal jurisdiction must address the objection. The relevant provision now directs that when faced with an objection to personal jurisdiction “[t]he court shall enter an appropriate order sustaining or overruling the objection.” 735 ILCS 5/2— 301(b) (West 2002). In comparison, the previous version stated that “[i]f the court sustains the objection, an appropriate order shall be entered.” 735 ILCS 5/2 — 301(c) (West 1998) (amended 2000). Whereas previously the court only needed to enter an order if the objection was sustained, under the current law it must enter an order whichever way it decides the issue. The trial court thus erred when it failed to address the State’s objection to jurisdiction.
With a combined motion, this still leaves open the question of whether the objection to jurisdiction must be decided before other issues. We have already noted the rule that a court’s judgment is not valid if the court did not have jurisdiction over the parties. This is another way of saying that until the court has personal jurisdiction over a party, it has no power to act with respect to that party. As one federal court has put it: “[LJogic compel[s] initial consideration of the issue of jurisdiction over the defendant — a court without such jurisdiction lacks power to dismiss a complaint for failure to state a claim.” Arrowsmith v. United Press International, 320 F.2d 219, 221 (2d Cir. 1963).
From the defendant’s perspective, it may not seem to matter *994whether the trial court addresses the jurisdiction question or the pleading question first. In our case, for example, the State is probably-satisfied regardless of whether it prevails because the court had no jurisdiction or because the complaint failed to state a sufficient cause of action. But the difference to the plaintiff can be significant. Whereas a dismissal for lack of personal jurisdiction does not operate as a disposition on the merits for res judicata purposes (134 Ill. 2d R. 273), a dismissal for failure to state a cause of action does. Bond v. Dunmire, 129 Ill. App. 3d 796, 801, 473 N.E.2d 78, 82 (1984). To decide the case on the merits instead of on jurisdictional grounds, therefore, may prevent the plaintiff from refiling the cause of action in another forum.
For these reasons, jurisdictions that allow a defendant to file one motion asserting both a lack of personal jurisdiction and an insufficient cause of action generally require the trial court to consider the jurisdictional issue first. See, e.g., Madara v. Hall, 916 F.2d 1510, 1513-14 (11th Cir. 1990); Branson v. Exide Electronics Corp., 625 A.2d 267, 269 (Del. 1993); but see W.H. Elliott & Sons, Inc. v. Nuodex Products Co., 243 F.2d 116, 117 (1st Cir. 1957) (trial court decided pleading question first, with the determination to become final only if court later found it had personal jurisdiction). We agree with their reasoning and hold that when faced with a motion combining an objection to personal jurisdiction and a section 2 — 615 motion to dismiss for failure to state a cause of action, the trial court must address the jurisdictional issue first.
Although the trial court in our case did not address the jurisdictional issue, the record allows this court to do so. For a court to acquire personal jurisdiction over the defendant, the defendant must be served, waive service, or consent to jurisdiction. Thill, 113 Ill. 2d at 308, 497 N.E.2d at 1161. There is nothing in the record to indicate service on either defendant, and Ryburn admitted at the hearing that neither was ever served. Nor did the defendants ever waive service. As for consent, the record shows that the State filed an appropriate combined motion and took no other action until the hearing on the motion, at which the assistant Attorney General made a few comments in support of the motion. We conclude that the State did not consent to personal jurisdiction merely by attending the hearing on its motion. Accordingly, the trial court did not have personal jurisdiction over the defendants.
In light of the foregoing, we must vacate the trial court’s dismissal on section 2 — 615 grounds. The court did not have jurisdiction over defendants and therefore had no power to address that issue. However, because defendants were not served and did not consent to jurisdic*995tion, we order that the objection to personal jurisdiction be granted and plaintiffs complaint be dismissed on this basis.
Order vacated; cause dismissed.
TURNER and STEIGMANN, JJ., concur.