Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Enter a language and return a greeting  RSS feed

 
Fred Victa
Ranch Hand
Posts: 200
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class called "HelloController" and it extends SimpleFormController.

I have the following method inside of HelloController.java:

protected Map referenceData(HttpServletRequest request) throws Exception
{

Map<String,String> language = new dHashMap<String,String>();
language.put("Spanish", "Buenos Dias");
language.put("French", "Bonjour");
return language;

}

How would I create a JSP file that would accept a language as its input and return a greeting in that language? For example, if the user enters "Spanish", then the user should see "Buenos Dias." If the user enters "French", then the user should a see "Bonjour".
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your want to explore the fmt category of JSTL tags.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!