• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

persistent values in jsp

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a formjsp with some dropdrowns(date,month,year) and textfields.
after submitting the form , i am doing validations in a servlet.
all values i am putting in session attribute and forwarding to formjsp. i am able to persistent text fields. but how to persistent dropdrowns. please somebody help in it.



 
Sheriff
Posts: 67750
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
Set the selected attribute on the appropriate <option> element.
 
manepalli rajesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Set the selected attribute on the appropriate <option> element.



thanks.can you give me example.
user select a date (dropdrown) in formjsp and submits. i captured the date and put it in a session of servlet. when i return from servlet to jsp. i know the date(which he selected).but how to persist the date. dependds on the condition.one date has to select .
so for which option element , select attribute i can write.

can you help me please.if possible give me example

 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may either use a framework that will do this for you
or
you can track which date was selected, set that value in the request attribute when returning to the JSP; read the request attribute and set the appropriate SELECTED field.
 
manepalli rajesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:You may either use a framework that will do this for you
or
you can track which date was selected, set that value in the request attribute when returning to the JSP; read the request attribute and set the appropriate SELECTED field.



i am not using any framework. yes you are correct. i am capturing the date value with session attribute in jsp. but this value should be select for one of the options given under select element.
can you give me example please.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


[EDIT]

Aligned comments
 
manepalli rajesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for helping me. but i cant get the actual point following is my code.

this is my formjsp after i submitted this, i captured the year in servlet and from servlet, control is transfered to formjsp page.
now in enteredyear attribute contains the year that i selected in the formjsp(firsttime). now date has to be selected automatically is entereddate year value.
where can i kept my select attribute in which option element? . please give me example
 
Bear Bibeault
Sheriff
Posts: 67750
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
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

 
I'm doing laundry! Look how clean this tiny ad is:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic