.NET vs. Java: ViewState

K

Kikoz

Hi all.

It's a general question, just for the sake of curiosity:

..NET introduced ViewState as a way to keep the state across postbacks. I
love it, use it all the time, blah blah...
But Java has been around for much longer than .NET. I don't have experience
with it. Does Java have anything like ViewState? How do those guys keep the
state? I mean, of course you can create your own session and store it in db
or use cookies, but is there any "stand alone" object / mechanism in Java?

Thanks,
Kikoz
 
P

Patrice

The viewstate just uses and hidden HTML form field. You could do the same
with Java (or more precisely with whatever Java uses to built an HTML UI).

ASP.NET provides a clever server side programming model but behind the scene
it just has to rely on HTML...

Patrice
 
K

Kikoz

Actually, it doesn't have to relay on HTML. .NET just uses HTML hidden field
by default. You can keep ViewState in Application, or Cache, or hard drive.
I was asking if Java has any "out of the box" solution to free you from
developing your own method. Thanks, anyway :)
Anyone with Java background?
 
F

Flip

Anyone with Java background?
We had to spend vasts amount's of time creating/debugging/maintaining a BOAT
load of code to setup a framework and ensure current/new JSPs/servlets use
that framework. :<

In moving to .NET (creating webapps at home :>), there are SOOOOOO many
things C#/.NET just do better/faster/cleaner than the j2ee world. :< The
..NET world gives you and awesome framwork to start off with. In j2ee, you
have the APIs and good freak'n luck! :<

re state
I'm much happier at home with .NET than I was with j2ee! :>

hth :>
 
J

John Saunders

Kikoz said:
Hi all.

It's a general question, just for the sake of curiosity:

.NET introduced ViewState as a way to keep the state across postbacks. I
love it, use it all the time, blah blah...
But Java has been around for much longer than .NET. I don't have
experience with it. Does Java have anything like ViewState? How do those
guys keep the state? I mean, of course you can create your own session and
store it in db or use cookies, but is there any "stand alone" object /
mechanism in Java?

I believe that JavaServer Faces technology is a fairly close equivalent to
ASP.NET, and if I remember correctly (I had been working on the J2EE
Tutorial up to a month ago), there _is_ an equivalent to ViewState.

John Saunders
 
P

Patrice

AFAIK how it is implemented is not part of the specification. This is just a
"statebag" that is implemented either server side or client side.

For a client side implementation IMO it's likely it uses an hidden field as
ASP.NET does (easiest way to be able to set something client side and to
have it submitted on the next round trip) and it works regardless of wether
or not cookies are enabled.

Patrice

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top