Static rendering (without DWR) for mobile UI
-
Hi,
I have the task to write a simple UI layer which could be used with mobile phones.
For this, I tried to edit (=dumb down) the WEB-INF/tags/pointComponent.tag, because I thought that the pointComponent.tag is responsible for rendering the actual PointValues. As it seems, only partly: it renders some images, which then will get "overwritten" (or updated) by view.js, ViewDwr. and MiscDwr.**.
As I understand, the DWR library makes remoting possible. But I'd like to skip that: I don't want any AJAX calls to the server. Rather, I'd like to render a static page with the PointValues already in it. (Yes, continuous updating is not so necessary right now: I'd only like to see the PointValues.)
For me, the best would be if I could get hold of that DataPoint from the pointComponent.tag with some simple EL expressions, e.g. ${vc.dataPoint.lastValue}.
Not being able to solve the question above, I tried to write a simple JSP, based on ViewDwr.java. It was something like this:
ViewDao viewDao = new ViewDao(); View view = viewDao.getView(4); List<ViewComponent> viewComponents = view.getViewComponents(); for (ViewComponent vc : viewComponents) { DataPointVO dp = ((PointComponent)vc).tgetDataPoint(); String extName = dp.getExtendedName();
It kinda works, but it isn't a nice solution. I tried to extract this to a JavaBean, but I wasn't able to import/set up the project in Eclipse. (That might be an other post.) (So no compiling or debugging for me, yet.)
Actually, I don't even want to write my own beans and JSPs: I'd like to reuse code already written (e.g. pointComponent.tag), but I just can't. Any suggestions?
Thanks in advance,
Beci -
I think that you should not directly change Mango's existing view components but instead of that to create new mobileView components.
So you should create your own tag and view files to somehow add on the existing codebase. And in the mobile view you just select use this lightweight non-Ajax view layer after you login to system (or even before that?).
But technically I don't exactly know how to do it? -
jupepe has the right idea. There may be some possible reuse of existing code, but don't count on it: Mango was developed with AJAX foremost in mind. I suggest that, to build "static" pages for mobile devices, you create a new set of JSPs and MVC components.
Editing to note that the "snippet" subdirectory may provide some reusable functionality. But, unlike tags, this code relies upon context attributes, so you'll need to be careful of namespace collisions.
-