[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Web Server passes control to JSP page?

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

My test situation:

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

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

upload.jsp
--------------
<%  
  if(request.getContentLength()) > 1) {
     pageContext.forward(....);
  }

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

check.jsp
----------------
<%= 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

0
elmoredaniel
Asked:
elmoredaniel
1 Solution
 
jessegivyCommented:
...not neccessarily, are you sure your condition was met?  And could you explain it?

  if(request.getContentLength()) > 1) {
     pageContext.forward(....);
  }
0
 
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!!
0
 
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help 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.
0
 
borislavmarkovCommented:
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 ?
0
 
elmoredanielAuthor Commented:
Yes, of course I have the enctype right. Yes, the file uploads. Yes I know what I'm doing!
0
 
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.
0
 
GranModCommented:
PAQed with points refunded (250)

GranMod
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now