Hi,
I am trying to create a server-side view technology that separates data, scripting, and layout from each other.
I wanted it to support dynamic views instead of static views, leverage XML, and be able to be plugged in to
most web application frameworks.
Some examples of what I'm thinking of are below. I'd like some feedback to gauge the feasibility
of my idea and see if there are any other technologies that would be better suited for what I'm trying to do.
Thanks.
The idea:
I thought of creating an XML file that maps an ID to the name of a CSS, JS, or JSP page.
So, in your XML file, you would have:
<map>
<id>top</id>
<css>top1</css>
<js>top2</js>
</map>
In this mapping, top1 would refer to top1.css and top2 would refer to top2.js
So if you had the following JSP file:
<html>
<body>
<div id="top"></div>
</body>
</html>
The JSP processor would add the CSS contained in top1.css and the JS contained in top2.css
and the output would be a new JSP file:
<html>
<body>
<div id="top" style="(insert CSS here)" onclick="(insert JS here)">
</div>
</body>
</html>
You can also use other types of mappings. You can map an id to another JSP file:
<map><id>top</id><jsp>top-new</jsp></map
or can map an ID to an SRC
<map><id>toppicture></id><src>helloworld.jpg</src></map>
So you can have:
<html>
<body>
<div id="top"></div>
<img id="toppicture">
</body>
</html>
And it would be processed into:
<html>
<body>
(insert the contents of top-new.jsp)
<img src="helloworld.jpg">
</body>
</html>
Other possibilities:
You can map an ID of an HTML table to an SQL table in a database so that you can populate
the rows of the HTML table with dynamic data.
You can map an ID of a DIV to a Java function. So, the contents of the DIV would contain the output of the function.
You can map an ID to different CSS, JS, or JSPs based on the browser that is detected by Java
Notes:
- Each XML file would have the same name as a JSP file and map one to one. So, hello.xml would provide mappings for hello.jsp
- After processing the JSP file, the view is saved. The view is only regenerated if there are changes to the data so that the view
doesn't have to be remade for every request for the page.
- The JSP processor would be written in Java and possibly run in a servlet or a Controller if you are using MVC
- The XML file would have multiple mappings for each ID in the JSP page
- The XML mappings can be reused for different pages on your site by just modifying a few mappings
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









