• 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

Retrieving a value from html select element in jsp

 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

I am a Newbie in JSP
I have a select html element in my jsp page.
After selecting a particular value i need to capture that particular value in jsp and do my functionality with the obtained value.

How can i achieve this in jsp?
Should we use javasript for obtaining this?

Someone please help me regarding this.
producing some example code would be appreciated....!

Thanks in Advance..
 
Sheriff
Posts: 67746
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
Are you talking about before or after the form is submitted?

If after, just use request.getParameter() in the submitted servlet to obtain the value. If before, then this is a JavaScript, not a JSP question.
 
Gopi Chand Maddula
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My functionality is to select a type of currency in a select element
and then calculate the charged amount based on the selected currency and display next to the select element automatically.

is it possible in JSP?

or should i use any other technology?

this should be done before submitting the form only...!
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to do some logic (in you case calculate) only two possible options are there

1. you should use only java script to do the calculation
2. or you should make ajax call to jsp/servlet to do the same.

I think in your problem, pure javascript based solution is enough
 
Bear Bibeault
Sheriff
Posts: 67746
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
JSP is obviously not going to help. If you need help understanding how JSP works in order to understand why, I suggest this article.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ya dude can do it in java.. i think java has all the answers to your query..

Here what i suggest you can call a java script method on select=your_method();

Then in that you can calculate the currency and display it in the other text box. As


I think this solves your problem then.
 
Bear Bibeault
Sheriff
Posts: 67746
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

Gaurav Ag Agarwal wrote:
Ya dude can do it in java.. i think java has all the answers to your query..

Here what i suggest you can call a java script method on select=your_method();


Java is not the same as JavaScript. So no, your solution does not use Java.


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic