A surgical stapler is provided which is insertable through an endoscopic tube to enable a surgeon to staple a hernia patch to tissue inside a body cavity. The endoscopic surgical stapler includes a staple cartridge pivotally mounted on the distal end of a support tube extending from a handle provided with an actuator mechanism for actuating a staple forming mechanism inside the staple cartridge to fasten staples to the tissue. The staple cartridge is adjustable to different angular orientations relative to the support tube. The staple actuator mechanism is operable to actuate the staple cartridge in any of the angular orientations. The support shaft is rotatable about its longitudinal axis relative to the handle to adjust the rotational orientation of the support shaft and the staple cartridge. The staple cartridge is rotatable about its longitudinal axis relative to the support shaft to adjust the rotational position of the staple cartridge relative to the support shaft. Separate actuator mechanisms are provided on the handle to control the pivotal movement of the staple cartridge, the rotation of the support shaft, and the rotation of the staple cartridge relative to the support shaft.