Web Server passes control to JSP page?

I don't understand how the following is possible, but apparently it is.

My test situation:

<form action="upload.jsp" ...>
<input type="file" ...>

I loaded the input with a very large file, then hit submit.

  if(request.getContentLength()) > 1) {

  session.setAttribute("testvar","I should not exist until the file upload is received.");

<%= session.getAttribute("testvar") =>

I ran check.jsp right after I hit the submit button. And the session var "testvar" existed immediately, it did not exist before I hit submit. How is this possible? The upload.jsp did not "run" because it would have redirected the request, yet it did "run" because it set the session variable. I have tested this a variety of different ways and yeilded the same results.

~I am very confused

Who is Participating?
PAQed with points refunded (250)

Community Support Moderator
...not neccessarily, are you sure your condition was met?  And could you explain it?

  if(request.getContentLength()) > 1) {
elmoredanielAuthor Commented:
It doesn't matter. I can take the if statement away and just have it forward immediately and I get the same results. Seriously this is weird, try it!!
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
Just try running the same thing after you have restarted the server i think it must fail, as such i am not sure.

In previous case i think your session was yet maintained so only it might have happened.

Just try & get Back.

Thank you.
elmoredanielAuthor Commented:
shivaspk, good thought. I found that as long as the session scope has been initialized (by setting any attribute in it) then the strange scenario still exists. Which futher makes this more confusing.
when uploading a file your enctype of form should be set.

>>    <form action="upload.jsp" ...>

What do you have instead of "...", do you have enctype, so browser send the file correctly?
Do you upload the file correctly ?
elmoredanielAuthor Commented:
Yes, of course I have the enctype right. Yes, the file uploads. Yes I know what I'm doing!
elmoredanielAuthor Commented:
borislavmarkov, I apologize for my seeming tactless response, and here's the answer to the question for future visitors.

The web server does indeed pass the full request to java server and begins processing the page, at least with the  configuration I have (IIS -> JRun). The problem is, the browser is clueless about what's going on. It must continue to ship the data upward, then it can respond to any "queued" responses.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.