A jack staff (also spelled as jackstaff) is a small vertical spar (pole) on the bow of a ship or smaller vessel on which a particular type of flag, known as a jack, is flown.

A jack is a national (originally naval) flag flown from a short jackstaff at the bow of a vessel, while the ensign is flown on the stern. Jacks on bowsprits or foremasts appeared in the 17th century. The word "jack" is said to result from the signature Jacques of King James I in whose reign (1603–1625) the Union Jack was designed.

The jack staff was introduced in the 18th century. The jack is typically flown from military vessels, including submarines, while at anchor or moored pierside, but not while underway. Civilian vessels such as private yachts have also been known to fly the jack of the nation of their homeport, also from a jackstaff, while moored or at anchor.

More Info: en.wikipedia.org