jsfjsf-2seamseam2

How to generate new web page programmatically


I want to create a small forum using JSF/Seam.

When I post articles, a new page should be generated using that article name. For example, I posted an article named "How to Learn Java", then the new page should be named like "how-to-learn-java.xhtml". How can I implement this function? Thanks!


Solution

  • Its a bad approach. I am not aware about seam. But better way will be keeping the articles in DB and get it rendered in one template. Create a data access POJO for your article which is having fields like 1.articleHeader.
    2.articleName.
    3.articleContent.
    4.articlePics
    5.articleLinks

    In the template use these fields to display the page your way.

    Url will look like http://yourdomain.com/articles.jsf?id=23472305
    where 23472305 is the db id for the article