This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Dropdown menu in Servlet to displayed the selected value  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Servlet with a dropdown menu of Items to be selected.
Upon selecting and clicking a submit button, the doPost will be invoked, and another section with some graphics will appear below the dropdown menu. However dropdown menu will no longer show the selected value since the doPost rewrite the dropdown menu.

doPost(){

if click() {
write the dropdown menu and a section with Graphics.
}
}

How can i have the selected value still displayed?

Upon selecting another item (before the submit button is clicked), I want to remove the section again. So that after another item is selected and submit button is clicked, then I shall display a section below with other graphics.

Any help is greatly appreciated.

[ September 11, 2006: Message edited by: Bear Bibeault ]
[ September 11, 2006: Message edited by: Ken Flor ]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ken,

According to you requirement description it is better to apply an AJAX solution.

It needs a little servlet + javascripting.
-Lanka
 
Ken Flor
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

thanks for your reply. However we are building from Servlet.

I find it a hassle that Servlet either call doGet or doPost and will override and re-paint the current html screen.
Is there anyway that we can prevent it from override/re-paint the screen? So that my selected value from drop down menu will not be overridden?


thanks.
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ken Flor:

I find it a hassle that Servlet either call doGet or doPost and will override and re-paint the current html screen.
Is there anyway that we can prevent it from override/re-paint the screen? So that my selected value from drop down menu will not be overridden?



Yes, and Lanka just told you what it is.

That you're coding the server side of this app with Servlets (or PHP, or ASP, or Perl, etc..) doesn't change the fact that the end result is going to be client side HTML and Javascript. If you don't want to re-draw the entire screen, you're going to have to do some client side scripting.
[ September 12, 2006: Message edited by: Ben Souther ]
 
Ken Flor
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

thanks for all the help rendered.

Can I just check. If I use AJAX, can I embed the AJAX codes in my servlet?

So that dropdown menu is binded to the AJAX. So if i choose something in the dropdown menu, AJAX sent to the the same servlet, and did some processing and return the value without reloading the servlet.
Yet at the same time, if there is another button called "Show Content" on the same servlet, and if I click on this button, it will invoke doGet?
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!