Both of these characters have to face conflict that is both internal and external. If the character of Hamlet is examined, it is clear that his conflict in Act I scene 2 is internal. He is struggling massively with his feelings of grief at the death of his father and also his anger at his mother at having re-married so swiftly. This makes him feel that the world is pointless and without worth:
How weary, stale, flat and unprofitable
Seem to me all the uses of this world!
Fie on't, ah fie, fie! 'Tis an unweeded garden
That grows to seed...
However, what introduces the external conflict to the play is the Ghost, who suddenly places Hamlet in a conflict with Claudius which he cannot ignore, although he does his best to procrastinate as much as possible.
In the same way, Willy Loman's principle conflict is internal. He struggles with his delusions and he likewise struggles to maintain his sanity, constantly returning to the past in his own imagination. However, at the same time, his inability to accept himself for who he is and also accept his boys for who they are brings him into conflict with Biff, primarily. Note what he says to Linda about Biff's life in Act I:
How can he find himself on a farm? Is that a life? A farmhand? In the beginning, when he was young, I thought, well, a young man, it's good for him to tramp around, take a lot of different jobs. But it's more than ten years now and he has yet to make thirty-five dollars a week!
It is Willy's high ideals for himself and for Biff that create the source of the external conflict, as Biff tries to get his father to see him, love him and accept him for who he is, rather than what he isn't.
Both Hamlet and Death of a Salesman are tragedies. Shakespeare's play, however, is in the Aristotelian tradition. The hero must be a person of the highest rank, because the audience will only care about what happens to an important person. Common people are only fit subjects for comedy. Death of a Salesman is about the tragedy of a common man. This is a deliberate departure from one of Aristotle's rules in his Poetics. With regard to this difference, Arthur Miller himself stated:
Aristotle having spoken of a fall from the heights, it goes without saying that someone of the common mold cannot be a fit tragic hero. It is now many centuries since Aristotle lived. There is no more reason for falling down in a faint before his Poetics than before Euclid’s geometry, which has been amended numerous times by men with new insights; nor, for that matter, would I choose to have my illnesses diagnosed by Hippocrates rather than the most ordinary graduate of an American medical school, despite the Greek’s genius. Things do change, and even a genius is limited by his time and the nature of his society.
Arthur Miller is one of many modern playwrights who proved that Aristotle was often wrong about drama and does not have to be revered and obeyed religiously. Most modern theater goers would agree that they have more sympathy for Willy Loman than for Hamlet or any other the other kings, queens, princes, and elite characters in Greek tragedy or in Shakespeare. What Hamlet and Willy Loman have in common is that they both die tragic deaths. But we relate more to Willy Loman and therefore experience what Aristotle specified as another requirement of tragedy: the combined emotions of pity and terror. What happened to Willy could happen to all of us--and often does!