Yes, Java fern will attach itself to any rough surface. Java fern is an epiphyte, which means its roots will stick to something instead of rooting in the soil. The plant does this to protect itself against the water current.
Java fern usually attaches itself to rocks, driftwood, and tree roots in the wild. Likewise, it will also stick to similar locations when kept in an aquarium.
Generally, you can just put Java fern inside a tank, and it will attach itself to its preferred location after a while.