Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Passing Variables from jsp to servlet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i have some variables defined in my jsp document like this :



Now i have a servlet that i need to pass this variables to it

i have a submit form that call the servlet like this



But i cannot get access to this variables,what is the way to get to this varibales from the servlet?

Thanks

MIchael
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this a legacy JSP? Modern JSPs should not contain Java code.

In any case, of course there can be no passing of the data from the JSP to the target of the form submission. Remembeer that the sole purpose of the JSP is to generate an HTML page to send to the browser. Once that happens, the JSP is long gone.

You'll either need to use hidden inputs in the form to carry the data, or store the data in the session for later retrieval.
 
Michael Melamu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You'll either need to use hidden inputs in the form to carry the data, or store the data in the session for later retrieval.



And how do i do that if i may ask?

Thank you very much for the quick reply
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Melamu wrote:

You'll either need to use hidden inputs in the form to carry the data, or store the data in the session for later retrieval.


And how do i do that if i may ask?

How about starting with google?
reply
    Bookmark Topic Watch Topic
  • New Topic