www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help! what is this jsp file doing??

  1. #1
    Join Date
    Sep 2006
    Posts
    15

    Help! what is this jsp file doing??

    Hi there,

    Can someone please give me an idiots guide to exactly what this JSP file is doing.

    I can see that its a store request from the name, and the java seems to be creating some parameters and date stamping then saving them some where but thats about it.. am i on the right track or completely off?

    sore_request.jsp :

    Code:
    <%@ page language="java" import="java.util.*,java.text.*, java.io.*"
        contentType="text/html; charset=UTF-8"
    %><%
    response.setHeader("Cache-Control","no-store"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    %>
    <html>
    <head>
    <title>store request</title>
    </head>
    <body>
    x
    <%
        Properties prop = new Properties();
        
        Enumeration pars = request.getParameterNames();
        
        while (pars.hasMoreElements())
        {
          String par = (String) pars.nextElement();
          prop.setProperty (par,request.getParameter(par) + '\n');
        
        }
        
        // Format the current time.
        SimpleDateFormat formatter
            = new SimpleDateFormat ("dd_MM_yyyy HH:mm:ss");
    
        formatter.setTimeZone(TimeZone.getTimeZone("Greenwich")) ;
        
        String dateString = formatter.format(new GregorianCalendar(TimeZone.getTimeZone("Greenwich")).getTime());
    
        prop.setProperty("request_time", dateString + '\n');
    
        prop.remove("Submit"); // Submit value is the text on the submit button,
                               // does not need to be shown.
    
        String message = prop.toString();
    
        SimpleDateFormat OSformatter
            = new SimpleDateFormat ("yyyyMMddHHmmss");
    
        OSformatter.setTimeZone(TimeZone.getTimeZone("Greenwich")) ;
        
        String OSdateString = OSformatter.format(new GregorianCalendar(TimeZone.getTimeZone("Greenwich")).getTime());
       
        FileOutputStream outFile = new FileOutputStream("/var/log/stored_request/" + OSdateString + ".log", true);
        DataOutputStream outStream = new DataOutputStream(outFile);
    
        outStream.writeBytes(message + "\n\n");
        outStream.close();
        outFile.close();
    %>
    </body>
    </html>
    Last edited by Paul_83uk; 02-27-2007 at 11:42 AM.

  2. #2
    Join Date
    Jun 2005
    Posts
    94
    Hi,
    I could explain all of it,but its too big to explain

  3. #3
    Join Date
    Oct 2004
    Location
    The very depths of programming hell
    Posts
    828
    What a valuable contribution that was mickscool

    Maybe you should consider learning basic JSP paul? Knowing what it does isn't a great deal of good unless you can change it to do exactly what you want anyway.

  4. #4
    Join Date
    Jun 2005
    Posts
    94
    Maybe you should consider learning basic JSP paul? Knowing what it does isn't a great deal of good unless you can change it to do exactly what you want anyway.
    Well said......

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles