• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Form Variables vs Session Variables

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anyone tell me whether its better to use Action form variables or variables in session when we want to transfer data between Action class and JSP? Also please list the advantages of using either one of them.
Thanks in advance.

- Pavan.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Action form variables??? Are you talking about Struts here?
 
Pavan Kumar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant Struts Action Form.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I prefer to use variables defined on my action form. At a minimum this gives the JSP developer a place to look up the name of the properties. Also, if I had a value in my Action that I needed to display on my jsp I would store it in the request before I stored it in session.

- Brent
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

well a normal ActionForm or ValidatorForm is like a pojo, all the simple variables should be type String , the common scope is request

but you can create special variables with scope session before load a jsp
(maybe a list for a html:select), why?, because if you working with validation and detects any error, its create a new request and lost the variable that represents a List, of course that you have a variable or property that represents the value selected of the List (i had this problem if i dont use session scope for the list)

if exist another better way, please let me know

Regards
Manuel
[ October 08, 2006: Message edited by: Manuel Jordan ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic