This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
master stewards:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
garden masters:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
gardeners:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

accessKey and optionsCollection

 
pioneer
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends ,

This time its 3 questions. Would need your help.

1) I want to be able to make the user use the keyboard character to access certain field on my form. there is an attribute called "accessKey" which can be used for this purpose for the html:form tag. I dont know how practically this can be done. I tried googling around but did not yield any results. May be the way i am finding may be wrong.

2) for the html ptionsCollection tag what does the label and value stand for ? It is confusing me.

3) Wanted to what is the difference between <html:errors/> and <html:messages/> ?

Can anyone suggest on this please ?

Also i would like to know if there is some book available which gives practical examples on all the Struts html,bean,logic tags. I really would like to have a book which gives practical examples on all the struts taglibs.

Best regards,

Yogendra Joshi
[ October 27, 2006: Message edited by: Yogendra Joshi ]
 
pioneer
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Yogendra Joshi:
1) I want to be able to make the user use the keyboard character to access certain field on my form. there is an attribute called "accessKey" which can be used for this purpose for the html:form tag. I dont know how practically this can be done. I tried googling around but did not yield any results. May be the way i am finding may be wrong.


The accesskey attribute is a pass-through attribute, meaning that a Struts input tag such as <html:text> will just pass the attribute on to the generated HTML <input> tag. You can find more information about it in this link..

Originally posted by Yogendra Joshi:
2) for the html:optionsCollection tag what does the label and value stand for ? It is confusing me.


You use <html:optionsCollection> when you have a collection of JavaBeans for which you want one of the bean properties to represent the value of the option and the other to represent the label or publicly visible part of the option. You specify the bean property to be used for the value in the value attribute and the bean property to be used for the label with the label attribute of the tag.

Originally posted by Yogendra Joshi:
3) Wanted to what is the difference between <html:errors/> and <html:messages/> ?


See the headings "Displaying Messages" and "Displaying Error Messages" in this link.
 
Yogendra Joshi
pioneer
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill for your help. One more question..

The day before i tried using 2 Message properties file for my application. I wanted to test to have displaying the messages from 2 different resource bundles. For that there is an attribute called bundle of the bean:message tag. I tried doing it like this on my JSP :

<bean:message key="yogendra.test" bundle="resources.Messages">
and the other one like this :

<bean:message key="welcome.title" bundle="MessagesResources">

I have added 2 message-resources element in the struts-config.xml file , restarted the server mannier times but it always gives an error saying "No key found under the name MessagesResources or resources.Messages". If i remove one of them from struts-config.xml file , It just works fine. Can you let me know how can i get messages from both the files at once ??

Thanks in Advance again.

Yogendra N Joshi.
 
Merrill Higginson
pioneer
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you have more than one Message Resource bundle, all but one of them has to have a key attribute specified when you define the bundle in the struts-config.xml file. Example:

<message-resources key="moreResources" parameter="com.mycompany.MoreApplicationResources"/>

Then, when you refer to this bundle you must specify a bundle attribute. Example:

<bean:message key="name.label" bundle="moreResources" />

Any resource without a key attribute is considered to be the default message resource, and can be referred to without a bundle attribute in the <bean:message> tag.
 
Yogendra Joshi
pioneer
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, Merrill it worked like Butter... :-)

Thanks for the immediate help. You've always been helpful. If like Sun Forums i would have had Duke Dollars , I would have given you all my 10 Dollars :-)

thanks again.

Yogendra N Joshi.
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!