Probably, panel is just hidden. Are you able to find element that contains "modalPanel" string in id attribute in HTML code generated?
No,None of the elements contain "modalPanel" id in HTML output.
Is this java code enough to generate modalPanel object. Or
do I have to more things in jsp and backing beans ?
Yes, that should be enough. Check that you've added panel to component tree and that all parent elements are rendered.