Controller:
public with sharing class Sample { public String name {Get;set;} public Sample() { } }
Visualforce Page:
<apex:page controller="Sample"> <apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:outputLabel value="Name"/> <apex:outputPanel styleClass="requiredInput" layout="block" > <apex:outputPanel styleClass="requiredBlock" layout="block"/> <apex:inputText value="{!name}" required="true"/> </apex:outputpanel> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>