|
| Sorry for crossposting but maybe this group is better for my question:
What in your oppinion is the best way of generating dynamic menu (html
links) in jsp? I did it following way:
e.g. i include in index.jsp the menu.jsp page with parameters like this:
<jsp:param name="menu" value="contact.jsp : Send email , admin.jsp :
Administration" />
then in menu.jsp i get the parameter menu and process it like this :
StringTokenizer stMenu = new StringTokenizer(request.getParameter("menu"),
",");
StringBuffer sbMenu = new StringBuffer();
while (stMenu.hasMoreElements()) {
String sLink = stMenu.nextToken();
sbMenu.append("<a href=\"");
/* get the url */
sbMenu.append( sLink.substring(0, sLink.indexOf(":")) );
sbMenu.append("\">");
/* now get description */
sbMenu.append( sLink.substring( sLink.indexOf(":")+1, sLink.length()) );
sbMenu.append("</a>");
}
out.println( sbMenu.toString() );
isn`t that too clumsy? Are there better ways to implement such a link
producer?
or would it be better to create a bean holding all the link mappings for
each site and just retrieve it in jsp?
Regards
Val
|
|