• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

html:option selected

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 JSP pages each with a dates drop down combo box whose contents are the same. However, on the first page the user can set a default date that s/he can use throughout the application.

So on the second JSP page in the drop down combo box, I'd like to set the selected default date (from the first page) as the first/selected value in the drop down but at the same time the user should be able to select a different date from the list.

Is this possible in struts?

Here's my code:

<html:select property="dates">
<% for(int i=0; i < listsize; i++)
{%>
<html ption value="<%bdatesList.get(i)%>"><%=bdatesList.get(i)%></html ption>
<%}
%>
</html:select>
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Place this default date into the ActionForm before entering the jsp. You probably need to use a SetupAction for this. The other option would be to set the default value into the date field within the ActionForm's reset method.

When this value is in the ActionForm Struts will automatically select the corresponding value(s) in the jsp.
 
Your buns are mine! But you can have this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic