Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design issue in jsp

 
Betsy Camel
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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 Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
could anyone please help me with the above... its a bit urgent !
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to use a Properties file? I will move this question to Java In General (Intermediate).
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • 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/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic