• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting input in JSP page

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to gather three pieces of data in a JSP page that I will use to "setProperty" in a bean (these three pieces of info will do a database lookup in the bean).
How do I just get some information from the user, like a few pieces of information, then continue processing, in the JSP page, with that info (like to setProperty in a bean)?
The HTML Text + Submit doesn't appear to work here (even with FORM ACTION = 'URL OF THE BEAN'>.
Thanks in advance!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You get information from a user with a HTML form and submit it to a servlet or JSP, NOT the bean. JavaBeans don't know a thing about HTTP requests.
Just about any JSP tutorial or book will have samples.
Bill
 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, you're saying that there's no way to just "get" some variables in a single JSP page and continue processing?
To do what I need to do, I'd then use a JSP page to get the variables and POST them to another JSP page where I could setProperty()'s in the bean.
Would that work OK?
 
Author
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike London:
So, you're saying that there's no way to just "get" some variables in a single JSP page and continue processing?
To do what I need to do, I'd then use a JSP page to get the variables and POST them to another JSP page where I could setProperty()'s in the bean.
Would that work OK?


Yes, each HTTP transaction involves a single request and a single response; there's no way to interrupt the processing and engage in an open-ended dialogue. What you're describing is the typical way of reading input from a web user: one page (either a static HTML page or a dynamic JSP page) presents a form, and another (or perhaps the same page, requested again) processes it once the user submits data.
 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks much.
I chained the JSP pages together as described then called the bean when needed.
Worked great.
I apreciate all the great replies and input!
-- Mike
reply
    Bookmark Topic Watch Topic
  • New Topic