JSP Java Tutorial

index.jsp


    
        Please Sign My Guest Book!
    
    
        

            

Please Sign My Guest Book!


            
                Your name:
                
                

                Your comments:
                

                
                

                
            
        

    

basic.jsp

<%@ page import="java.io.*" %>

    
        Thanks for Adding to the Guest Book!
    
    
        

Thanks for Adding to the Guest Book!


        Here's what you and others have said:
        

        <%
            String name = request.getParameter("TEXT1");
            String text = request.getParameter("TEXTAREA1");
            String file = application.getRealPath("/") + "test.txt";
    
            FileWriter filewriter = new FileWriter(file, true);
            filewriter.write("Name: " + name + "
");
            filewriter.write("Comments: 
");
            filewriter.write(text + "

");
            filewriter.close();
        %>