Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting input in JSP page  RSS feed

 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • 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!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • 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?
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!