In both cases you are asking with "where" for a location. So the part of speech you ask for is describing a location, and many languages have a special grammatical case for locations which is called locative case. But neither German nor English are such locative-languages. They don't have a locative case.
So you need a different construction. In German the replacement construction is:
- Location = local preposition + object in dative case.
Der Jäger steht in dem Wald (im Wald).
Der Zettel hängt an dem Brett (am Brett).
Das Buch liegt auf dem Tisch.1
Hans versteckt sich unter der Decke.
Die Leute stehen vor der Kirche.
Der Mörder lauert hinter der Tür.
The hunter stands in the forrest.
The note hangs on the board.
The book lays on the table.
Hans is hiding under the blanket.
People stand in front of the church.
The murderer is waiting behind the door.
1) In southern regions like Austria also »Das Buch liegt am Tisch.«
The complete construction itself is an object too. It would be a locative object in languages with locative case, but in German such a type of object that begins with a preposition is called »Präpositionalobjekt« (prepositional object).
locations vs. directions in German
Other than English, German separates locations and directions very strictly by different cases (dative and accusative) and by different question words.
Note, than in English you can use where also to ask for directions too ("Where did he go?" - "He went away."). In German you use »wohin« instead of »wo« to ask for directions, and also the prepositional object that indicates a direction is different:
- Direction = local preposition + object in accusative case.
Der Jäger geht in den Wald.
Ernst hängt den Zettel an das Brett.
Walter legt das Buch auf den Tisch.
Hans verkriecht sich unter die Decke.
Der Pfarrer tritt vor die Kirche.
Ilse schlüpft hinter die Tür.
The hunter goes into the forrest.
Ernst hangs the note on the board.
Walter places the book on the table.
Hans crawls under the blanket.
The priest goes in front of the church.
Ilse slides behind the door.
»Blut im (in dem) Auge« vs. »Blut ins (in das) Auge«
Both is correct, and both is »Blood in the eye« in English. But one is a location, the other is a direction.
Grammatical analysis of the complete sentence »Er hat Blut in dem Auge«:
subject (every subject always is in nominative case)
a mandatory completion of the Verb
tells us who (or what) is performing the action that is represented by the verb
personal pronoun, nominative case, 3rd person, singular, male
Verb, a form of »haben«
must match with subject in person, number and gender (i.e. 3rd person singular male)
tells us what the action of the sentence is.
a mandatory completion of the verb
a noun in accusative case, singular, neuter
tells us what it is, that he has.
- in dem Auge
an optional completion of the verb
tells us where he has the blood.
this prepositional object consists of:
describing, that something is inside of something else.
prepositions can not be inflected, i.e. they don't have gender, number, case, person or any other grammatical properties.
- dem Auge
a dative object inside a prepositional objects that begins with a local prepositions tells us the location to which the preposition refers. (in case of »in«: Inside which thing is something)
this dative object consists of:
defined, dative case, neuter, singular
dative case, neuter, singular