• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting value on form submission on same jsp page  RSS feed

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this problem,

I am showing a jsp page asking user to select a course from dropdown <select> options fetched from database.
When user selects a value and click on submit button , I want to show the details of the course on the same page .

So my problem is how can I get the value of user selection on the same jsp page.
Then I can make a query using that value and show other details on the same page.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the page is sent to the browser, it is just an HTML page like any other. So you'll need to use JavaScript for reacting to buttons and loading additional page resource (via Ajax, most likely).

Please read this article to understand how JSP operates and why it cannot be used once the page is loaded into the browser.
 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide a small code that do that.I am very rusty with Javascript.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that's not how things work here. Give it a try on your own and post here with problems you are having with your code.

You'll need to know how to handle events (like selecting) and how to make Ajax calls to fetch more data or HTML.

I highly recommend using jQuery to make it all much simpler than using raw JavaScript.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!