I open a server socket at localhost’s port e.g 11111, and I also include printstream for stream data which i would want to output as neat as expected like this
PrintStream ps=new PrintStream(socket.getOutputStream(),false);
ps.println("<h1>Hello, it works!</h1>");
I am looking forward to seeing the output as Hello, it works!
but it becomes like this <h1>Hello, it works!</h1>
Update
I am not working with serlet or jsp, this simply is a webserver I would like to display a welcome message once the user visit the http://localhost:111111
Thank you
If you are trying to create a simple web server then you need to return a valid HTTP response that contain status code and content-type at the very least:
You can find more details about what HTTP response look like here