This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Basically i have a 2 message resources bundles - once called "client" and the other called "server". how do i in a JSP check if a certain key exists in the client bundle and render it, but if it doesnt exist in the client bundle then render the value of the key in the server bundle. both bundles have a key name "customer.name" for example.
i know that to render the bundle i do: <bean:message key="customer.name" bundle="client"/> or <bean:message key="customer.name" bundle="server"/>
how can i check the first one to see if the key exist in the client bundle (can i use something like <logic resent> I could code some java in the action class that forwards to this jsp but that seems a bit hacky. any help would be great..
Originally posted by Ronan Dowd: I could code some java in the action class that forwards to this jsp but that seems a bit hacky.
I'm sure there is a way that this could be accomplished in the JSP, but any way you look at it, you'd be adding several lines in your JSP just to display one message. Since the goal of an MVC application is to have as little logic as possible in the JSP, that solution seems way more "hacky" than putting logic in your action class. One way to make it a little more elegant would be to put the message as a property in your Actionform and then have your Action class populate the property.