I am still fairly new to servlet devlopment. Is there anything similar
to the ispostback variable that is in ".net" in the servlet api. I am
just looking for some suggestions and guidance. My research has turned
up squat. Thanks. :)
i'm not an expert but i don't think there is.
Though using JSF, I was able to achive it by
In everypage, i added an hidden field
<h:inputHidden id="postback" value="unique_pageName" />
and I have a IsPostBack method.. first I get the value of the
"postback" id on the current page and then I check in request parameter
for value the value of the "postback". If there is and it's the same,
it's a postback. If there is no such id in request or the value of the
request is different from the value of "postback" on the current page,
then it's not a post back.
> I am still fairly new to servlet devlopment. Is there anything similar
> to the ispostback variable that is in ".net" in the servlet api. I am
> just looking for some suggestions and guidance. My research has turned
> up squat. Thanks. :)
Not exactly. A few things worth noting are:
ASP.NET is doing some behind-the-scenes magic here. Since the Servlet
API is intended to be close to a one-to-one Java mapping of the HTTP
protocol, the same magic isn't provided in servlets by default. You
could very easily reproduce it with a hidden form parameter, as Liming
mentioned.
The other thing about ASP.NET, though, is that it's designed for your to
put all your code into JSPs. In Java, this is considered extremely poor
form. If you look at JavaServer Faces (just to pick one example of an
application-level framework for web applications in Java... all the
other major options share this basic characteristic as well), you'll
find that you are encouraged to put processing code into event
listeners, and limit your JSP pages to the user interface. In a sense,
your "IsPostback" variable is the very fact that you're in a JSP to
begin with. Things that you would only do if IsPostback is true in
ASP.NET are done in event handlers. Things that you'd only do if
IsPostback is false would be done in the event handler that is about to
forward to this page, or in the implementation of the JSF component, or
in a bound backing bean method or property.
Give it a shot. It really makes sense, as you don't end up mixing
processing and display code in the same place; but it is a little
different.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation