Were to place pages...?

27 views
Skip to first unread message

Ralph Soika

unread,
Apr 26, 2018, 4:23:26 PM4/26/18
to MVC 1.0 Users Mailing List
Hi,
I am starting developing my first MVC application.

In the examples JSP/JSF pages are mostly located under /WEB-INF/jsp/
and in the controller than the outcome is for example "welcome.jsf"

This works, but I find placing pages into this location so unusual for a typical web application. 
If I place my pages in the root of the Web application, how should the output of the controller bean methods be? Or can I configure the 'root' directory of my pages?

Thanks for help

Ralph

RPE Colorado

unread,
Apr 26, 2018, 4:40:16 PM4/26/18
to jsr371...@googlegroups.com
I've not experimented with this myself, but if you take a look here [1] it appears that you can set the "javax.mvc.engine.ViewEngine.viewFolder" property to be whatever you want the view root directory to be.


--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users+unsubscribe@googlegroups.com.
To post to this group, send email to jsr371...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsr371-users/ce60a6f9-988a-4b91-933c-6ea147dbdaca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ralph Soika

unread,
Apr 26, 2018, 4:57:58 PM4/26/18
to MVC 1.0 Users Mailing List
Thanks for your answer.  
But how can I access the current ViewEngine instance?

===
Ralph


Am Donnerstag, 26. April 2018 22:40:16 UTC+2 schrieb RPE Colorado:
I've not experimented with this myself, but if you take a look here [1] it appears that you can set the "javax.mvc.engine.ViewEngine.viewFolder" property to be whatever you want the view root directory to be.

On Thu, Apr 26, 2018 at 2:23 PM, Ralph Soika <atari...@gmail.com> wrote:
Hi,
I am starting developing my first MVC application.

In the examples JSP/JSF pages are mostly located under /WEB-INF/jsp/
and in the controller than the outcome is for example "welcome.jsf"

This works, but I find placing pages into this location so unusual for a typical web application. 
If I place my pages in the root of the Web application, how should the output of the controller bean methods be? Or can I configure the 'root' directory of my pages?

Thanks for help

Ralph

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users...@googlegroups.com.

RPE Colorado

unread,
Apr 26, 2018, 5:20:11 PM4/26/18
to jsr371...@googlegroups.com
I'm not sure how to access the current ViewEngine instance (I'm pretty new to Ozark MVC myself and have only used the JSP view engine)... What are you wanting to do with the instance?

I believe that ozark is going to resolve the ViewEngine based on the suffix of the view file, if that helps any.

To change the view root folder like in your original question I believe it is just a matter of configuring the JAX-RS application context properties. Something like this if you are using annotations, or you can likely do the same with parameters in your web.xml file:

public MyApplication extends Application {
    @Override
    public Map<String, Object> getProperties() {
        Map<String, Object> props = new HashMap<>(); 
        props.put(PROP_KEY, PROP_VALUE);
        return props;
    }
}
 

To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users+unsubscribe@googlegroups.com.

To post to this group, send email to jsr371...@googlegroups.com.

Christian Kaltepoth

unread,
Apr 27, 2018, 1:05:16 AM4/27/18
to MVC 1.0 Users
Hi all,

by default MVC implementations will look for views in the "/WEB-INF/views" folder. But you can change this behavior by setting a configuration property in your Application subclass like shown here:


Please note that it is good practice to place them in "/WEB-INF" so that users cannot directly open these file which will typically fail, because this would bypass the MVC controller.

I hope this helps

Christian

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users...@googlegroups.com.
To post to this group, send email to jsr371...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Ralpus

unread,
Apr 27, 2018, 3:27:16 AM4/27/18
to jsr371...@googlegroups.com
thanks a lot for your answers. I will give feedback how I go 

Ralpus

unread,
Apr 27, 2018, 5:55:07 PM4/27/18
to jsr371...@googlegroups.com
Thanks for your explanation. 
After a bit of thinking, I finally understood the concept of MVC 1.0. Everything makes now sens to me and I am using MVC 1.0 successfully together with Facelets. It is really a great Framework!! 
I have summarized my learning curve in a blog:

Thanks for this great framework. I hope it will soon be part of Jakarta EE.

===
Ralph

To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users+unsubscribe@googlegroups.com.

To post to this group, send email to jsr371...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users+unsubscribe@googlegroups.com.

To post to this group, send email to jsr371...@googlegroups.com.

Christian Kaltepoth

unread,
Apr 28, 2018, 3:31:39 AM4/28/18
to MVC 1.0 Users
Hi Ralph,

thanks a lot for sharing the link to your blog post.

Feel free to send a pull request to add it to the "Learn" page of the mvc-spec.org:


This way the blog post will show up here:


Christian

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users...@googlegroups.com.
To post to this group, send email to jsr371...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users...@googlegroups.com.
To post to this group, send email to jsr371...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "MVC 1.0 Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr371-users...@googlegroups.com.
To post to this group, send email to jsr371...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages