We know <apex:InputField/> binds sObjects. For that reason, Salesforce display error messages just below the field like this if mandatory field values are not entered:
There are situations where we cannot use InputField to display to capture records. For example, if we need to display records from the wrapper class instance then, we have to use <apex:inputText/> instead of <apex:inputField/>. Otherwise, Salesforce will display error message:
<apex:inputField> can only be used with SObject fields
Wrap inputText field either <apex:outputPanel/> or <div> and use styleclass "requiredInput" and "requiredBlock" which are Salesforce provided.
Salesforce recommends not to use this kind of coding rather create your own components at this situation.
Workaround (Visualforce component)
I have tried to create a component referencing this site Controller Component Communication
This Visualforce Component has inputText field which will be rendered and styled to show it is required input and display error message when error occurred.
4. Visualforce Component Controller
5. Visualforce Page
6. Visualforce Controller
Now, after loading the Visualforce , input field will be displayed like this:
If input is empty, it will show error message like this: