• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Table Driven menu

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am tring to write a java method that will create a menu which derives its menu items from a database table.

Current scenario.

When I click on the menu in my XSL file, It pulls the menu items from a XML file. something like this
<tr><td class="head" colspan="2" align="center"><br/>Country of Origin</td></tr>
<tr class="input">
<td colspan="2" align="center" class="input">
<SELECT id="country" name="country">
<xsl:for-each select="//country/CodeList/Entry">
<OPTION class="input">
<xsl:attribute name="value"><xsl:value-of select="code" /></xsl:attribute>
<xsl:value-of select="name"/>
</OPTION>
</xsl:for-each>
</SELECT>
</td>
</tr>

where the list of country is stored in a file called country.xml

My need: Now when I click the menu, the data should be retrieved from a table which contains the various countries.

Any help will be greatly appreciated.

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you're already set up to handle XML, you may want to write some simple code that will read a database table and turn it into XML. Besides this, Oracle and other RDBs have utilities that you may want to look into that will turn tables into XML.
 
Sharadha Sankar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the prompt reply, but my requirement here is to avoid handling the data through XML. I just need to create a method which will derive data from the table and listens to the user's selection. Any feedbacks would be appreciated.
Thanks
Sharadha
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like just using the standard Struts architecture will work just fine for this:

1-Call a Struts action that gets the information from the database and puts it in an ActionForm bean
2-Have the action forward to a JSP that retrieves the values from the ActionForm bean and creates the menu based on that information.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic