• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Design issue in jsp

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a few static data which at present i have kept in an array. This data is a set of server names which have a tendency to be changed bimonthly. i am trying to connect to these server names using the for loop.

Now since these data may be changed,i dont want to compile the whole java class. i am planning to place the data in a xml file. Please tell me how to access these without involving complexities like sax, dom. is there any other way to iterate through the data?

Please help
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JSP is not the best place for parsing XML files.
It would be better to parse them with a Java object (instanciated from a servlet), bind the data to a scope object, and then forward to the JSP for markup.

That being said.
I've found Digester to be very easy to use.
http://jakarta.apache.org/commons/digester/
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the XML forum where the XML gurus hang out.
 
Betsy Camel
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks Ben for the reply. I actually wanted a means of iterating through the xml.

consider a properties file with values a, b,c.
Now i would like to iterate through these and get the values. I dont want to use complex designs like sax, dom, castor.

Please tell me if there is any other way of iterating.
 
Marshal
Posts: 27540
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would agree with Ben Souther that Digester is not that hard to use. But really, if you don't want to get involved with the complexities of XML, perhaps you ought to consider not using XML. If you just have something that would fit into a plain old properties file, then by all means use a plain old properties file.
 
Betsy Camel
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have decided to use plain properties file. but now how do i access the values in the properties file. i would like to get the values by iterating through the properties file.


I would be glad if someone could give me a proper design.
 
Betsy Camel
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could anyone please help me with the above... its a bit urgent !
 
Paul Clapham
Marshal
Posts: 27540
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use a Properties file? I will move this question to Java In General (Intermediate).
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The best solution is use

OsCache to refresh the static data in frontend or webapplication.

http://www.opensymphony.com/oscache/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic