Yes, creating a separate Java project would be the way to go. Just a simple Java Project suffices. To use it in the dynamic web project, you should not only add it as a project in the Build Path. You also need to refer it as Java EE module in the dynamic web project. Eclipse will then take care about buiding and placing the JAR the right way.
If you're on Eclipse 3.5 or older, then check the Java EE Module Dependencies section in the properties of the dynamic web project. You should add the Java project there.
If you're on Eclipse 3.6 or newer, then check the Deployment Assembly section which does essentially the same (it has just been renamed/grouped with other functions as per 3.6).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…