| Author |
Design issue in jsp
|
Betsy Camel
Ranch Hand
Joined: Oct 02, 2003
Posts: 119
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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/
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Moving to the XML forum where the XML gurus hang out.
|
 |
Betsy Camel
Ranch Hand
Joined: Oct 02, 2003
Posts: 119
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
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
Joined: Oct 02, 2003
Posts: 119
|
|
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
Joined: Oct 02, 2003
Posts: 119
|
|
|
could anyone please help me with the above... its a bit urgent !
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
How to use a Properties file? I will move this question to Java In General (Intermediate).
|
 |
Srinivas Kalvala
Ranch Hand
Joined: Oct 20, 2005
Posts: 257
|
|
Hello, The best solution is use OsCache to refresh the static data in frontend or webapplication. http://www.opensymphony.com/oscache/
|
 |
 |
|
|
subject: Design issue in jsp
|
|
|