If you want to do it correctly, then a p-trap is mandatory, but you also need to use a trap primer to keep that p-trap primed.
Some codes will actually allow the homeowner to forgo the use of a trap primer so long as they manually fill the trap from time to time, but that is not exactly a reliable method since the homeowner will quickly forget all about it.