>From: "Eugine F" <[EMAIL PROTECTED]> 
>
> Hello experts, 
> I have asked this question before but may be not properly. I am designing a 
> JSF application. I would like that the views to be rendered should be taken 
> by default from a data base. As far as I know the viewhandler is 
> responsible for the creation of views. I have looked at the implementation 
> of this class. I could see how the view is got or created got from the 
> request but I could not see where or how the JSF implementation searches for 
> the resource say "projects.jsp" or "projects.xhtml" in the web application 
> directory to be able to render it. That is the important section I need to 
> be able to modify my application to get the views from the data base. Could 
> any one give me a clue? 


If you are using JSP, the view handler dispatches to the target JSP.  The 
dispatch is a forward that invokes the JSP building the component tree while 
rendering the document.  This logic is in the renderView method of the view 
handler [2].

externalContext.dispatch(viewId);


I don't think you will be able to store the content of the view in a DB if you 
are using JSP but you might be able to do this using an alternative.  With a 
few modifications, Shale Clay [1] would allow you do store templates in a 
database.  You could store the content as markup fragments or maybe in database 
tables.

I've played with this idea but have not found the interest to take it to the 
next level.  There is a project in the shale sandbox that uses JPA to store 
metadata that could be used to construct the component tree [3].  This method 
would be like maintaining an XML file [4] in a DB.

Or, maybe the better approach would be to store markup fragments in a DB or 
better yet a Jackrabbit repository?  Clay has a couple parsers that are snapped 
in to read different types of markup [5].


[1] http://shale.apache.org/shale-clay/index.html
[2] 
http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?view=markup
[3] http://svn.apache.org/viewvc/shale/sandbox/shale-clay-jpa/pom.xml?view=log
[4] 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/resources/META-INF/clay-config.xml?view=markup
[5] 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayTemplateParser.java?view=markup



> thanks 
> Eugine 
> 

Gary

> _________________________________________________________________ 
> Die neue MSN Suche Toolbar mit Windows-Desktopsuche. Suchen Sie gleichzeitig 
> im Web, Ihren E-Mails und auf Ihrem PC! - http://desktop.msn.de/ Kostenlos 
> downloaden! 
> 

Reply via email to