• Post Reply Bookmark Topic Watch Topic
  • New Topic

persistent values in jsp

 
manepalli rajesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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.



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


[EDIT]

Aligned comments
 
manepalli rajesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!