I have to click the left side menu items , it needs to display static contents without using if else .
Say suppose, take the example of
http://www.askganesha.com/ when we click any link on the left side menu, content is displayed in the body. That part i have done using struts2 action wild
pattern usage. while displaying the content in
jsp, i have used if else tags, but i am not satisfied with what i have done. I want to apply a design pattern such that no if else is used and something like putting these left menu items in arraylist and display.
all the left side menu items i have given one common action as hello-* using struts2. if user clicks any link on the left side menu say suppose, clicked a link name health, then action will be hello-health.do and with the help of struts2 i can able to retrieve the health . Similarly if the user clicks on the link called wealth, then the action will be hello-wealth and i can able to retrieve the id wealth. Now like that if 20 items are there on the left menu then based on the id (like health or wealth) , i am using if(health) display health info, else if (wealth) display wealth info.
Which pattern i need to use to pick the left menu item dynamically ?
thanks & regards
swapna