This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi all, I am reading a jsp file named 'displaySE.jsp' from another jsp named 'actual.jsp'. In the actual.jsp, I am using FileReader and BufferedReader to read the 'displaySE.jsp' and printing it to page using out.println(). But it does not print anything , but instead of a .jsp file, if i use a .txt file, it prints out properly. Why is it not printing anything from a .jsp file? Actually i need to do this: Read the 'displaySE.jsp' from actual.jsp and search for some string like : if(lang.equals("eng")) ss="eng.html" in the 'displaySE.jsp' and write another line in it like: if(lang.equals("german")) ss="german.html" in it. Basically I am modifying the logic in the jsp file using I/O. Is this possible to do? Have anyone done something similar to this before? Please help me how to do this. Thanks, Priyha.
Originally posted by Priyha Jootu: Basically I am modifying the logic in the jsp file using I/O. Is this possible to do? Have anyone done something similar to this before? Please help me how to do this. Thanks, Priyha.
Hi, first of all this is not a correct way to change the logic in ur jsp, as a matter of fact ur business logic should reside in the form of java beans/classes and jsp should be used only as a front end for display purpose only. It is not a good practice to include business logic in JSP. And changing the code of jsp at runtime depending on the request is even worse. Try using MVC architecure thanx
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
subject: Reading and writing to a JSP file using I/O