C# Encoding a text string with line breaks

Yes – it means you’re using \n as the line break instead of \r\n. Notepad only understands the latter. (Note that Environment.NewLine suggested by others is fine if you want the platform default – but if you’re serving from Mono and definitely want \r\n, you should specify it explicitly.)

java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has been committed

A common misunderstanding among starters is that they think that the call of a forward(), sendRedirect(), or sendError() would magically exit and “jump” out of the method block, hereby ignoring the remnant of the code. For example: This is thus actually not true. They do certainly not behave differently than any other Java methods (expect … Read more

What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)

To simply explain the difference, doesn’t prepend the contextpath (refers to the application/module in which the servlet is bundled) but, whereas will prepend the contextpath of the respective application Furthermore, Redirect request is used to redirect to resources to different servers or domains. This transfer of control task is delegated to the browser by the container. That … Read more