tags:

views:

53

answers:

2

Hi,
I am a beginner in accessing backend xml files(which acts like a database)
in a jsp code.
can any one please provide me the links and references that provides good
understanding for beginners like me.
pls help.

+1  A: 

Some tips when working with JSP: Keep as much code as possible outside of the JSP. I've had very good results with creating a helper object at the top of the JSP. In the HTML of the JSP, I can then call the methods of the helper object to get at my data.

This way, I have a normal object (which doesn't depend on the JSP cra....framework) which I can test and use just like any other object.

So my suggestion is to create a couple of objects which allow you to access the database. In the JSP, have as little actual Java code as possible.

Aaron Digulla
A: 

You may want to take a look how to implement typical webapp design patterns in J2EE (see e.g. Sun's blueprint describing the webapp designs). Depending on complexity of your application, make a decision which pattern to use. You may also choose to use some of existing MVC frameworks build on J2EE (although I'd not advise that to a beginner).

Building a model classes around your XMLs would be a good start (there is a variety of ways to process XML in Java, check e.g. JAXP). Once a model is ready, you can start using it in your JSPs (implementing the view and controller per the pattern you will choose).

david a.