@ShowIf annotion in JSP pages

85 views
Skip to first unread message

dirkvra...@gmail.com

unread,
Apr 19, 2013, 4:38:06 AM4/19/13
to google-s...@googlegroups.com
Hey,

I'm building a web app with sitebricks and until now I was just using HTML with templating (as explained on the sitebricks website).

In the template and pages I use the @ShowIf annotation. But now that I am converting my pages to JSP's I was wondering if I could still use them?

What I'm seeing now is that they just get printed on the screen, should I do something else maybe?

The JSP usage is not really explained on the website...

Thx for the help!

Dirk

Eric Charles (GMail)

unread,
Apr 19, 2013, 5:33:24 AM4/19/13
to google-s...@googlegroups.com
Hi Dirk,

sitebricks does not support mixed html/jsp systems.

The jsp rendering template is implemented more like a hack and delegates
to the jsp compiler the responsibility to compile the jsp page, so it
will not take into consideration the specific html (or other) template
annotations.

That's something you loose, on the other hand, you can use any jsp
taglib and function you like.

About the documentation, jsp support is quite new and I will try to
create a pull-request explaining this.

Thx, Eric

Dirk Vranckaert

unread,
Apr 19, 2013, 6:04:04 AM4/19/13
to google-s...@googlegroups.com
I'm sorry if you understood you me wrong, but I do not want to mix both html and jsp's.

What I would like to do is to have a JSP called template.jsp (with a Template.java, with a @show annoation to the JSP) class and a second JSP called home.jsp (with a Home.java class that extends the Template.class).

For the java-part that works perfect. But for the HTML part the problem is that only my template.jsp is rendered and shown and nothing of my home.jsp is rendered and/or shown.

Is that possible?

Also, in the JSP pages it seems that I have prefix all my vars with 'pageFlow.'. Isn't it possible to force sitebricks to put everything in the root of the request?

Kr,

Dirk


2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com>
--
You received this message because you are subscribed to a topic in the Google Groups "Google Sitebricks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to google-sitebricks+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Eric Charles (GMail)

unread,
Apr 19, 2013, 6:11:29 AM4/19/13
to google-s...@googlegroups.com
Hi,
Do you put any annotation @Show on Home.java?
Anyway, even if you have one, the template.jsp will not be rendered.

As I said, the sitebricks JSP implementation just delegate to the JSP
compiler which has no notion of the sitebricks context (annotations...).
It just render the jsp with what it knows (taglibs...).

To support templating in JSP, just use your favorite templating taglib.

Hope this helps.

Thx, Eric

On 19/04/2013 11:04, Dirk Vranckaert wrote:
> I'm sorry if you understood you me wrong, but I do not want to mix both
> html and jsp's.
>
> What I would like to do is to have a JSP called template.jsp (with a
> Template.java, with a @show annoation to the JSP) class and a second JSP
> called home.jsp (with a Home.java class that extends the Template.class).
>
> For the java-part that works perfect. But for the HTML part the problem
> is that only my template.jsp is rendered and shown and nothing of my
> home.jsp is rendered and/or shown.
>
> Is that possible?
>
> Also, in the JSP pages it seems that I have prefix all my vars with
> 'pageFlow.'. Isn't it possible to force sitebricks to put everything in
> the root of the request?
>
> Kr,
>
> Dirk
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg...@gmail.com>>
>
> Hi Dirk,
>
> sitebricks does not support mixed html/jsp systems.
>
> The jsp rendering template is implemented more like a hack and
> delegates to the jsp compiler the responsibility to compile the jsp
> page, so it will not take into consideration the specific html (or
> other) template annotations.
>
> That's something you loose, on the other hand, you can use any jsp
> taglib and function you like.
>
> About the documentation, jsp support is quite new and I will try to
> create a pull-request explaining this.
>
> Thx, Eric
>
>
>
> On 19/04/2013 09:38, dirkvra...@gmail.com
> <mailto:dirkvra...@gmail.com> wrote:
>
> Hey,
>
> I'm building a web app with sitebricks and until now I was just
> using HTML with templating (as explained on the sitebricks website).
>
> In the template and pages I use the @ShowIf annotation. But now
> that I am converting my pages to JSP's I was wondering if I
> could still use them?
>
> What I'm seeing now is that they just get printed on the screen,
> should I do something else maybe?
>
> The JSP usage is not really explained on the website...
>
> Thx for the help!
>
> Dirk
>
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Google Sitebricks" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US
> <https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US>.
> To unsubscribe from this group and all its topics, send an email to
> google-sitebricks+unsubscribe@__googlegroups.com
> <mailto:google-sitebricks%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to google-sitebri...@googlegroups.com.

Dirk Vranckaert

unread,
Apr 19, 2013, 6:18:57 AM4/19/13
to google-s...@googlegroups.com
I must correct you when you say 'Anyway, even if you have one, the template.jsp will not be rendered.'
In fact it's only the template.jsp that get's rendered. The home.jsp does not.

And yes my home.jsp has an at, show and decorated annotation.

I've been looking into that (different templating) also but I don't see how I can plug in another templating framework.
Any help with that?

Kr,

Dirk




    Hi Dirk,

    sitebricks does not support mixed html/jsp systems.

    The jsp rendering template is implemented more like a hack and
    delegates to the jsp compiler the responsibility to compile the jsp
    page, so it will not take into consideration the specific html (or
    other) template annotations.

    That's something you loose, on the other hand, you can use any jsp
    taglib and function you like.

    About the documentation, jsp support is quite new and I will try to
    create a pull-request explaining this.

    Thx, Eric



    On 19/04/2013 09:38, dirkvra...@gmail.com

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


--
You received this message because you are subscribed to a topic in the Google Groups "Google Sitebricks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to google-sitebricks+unsubscribe@googlegroups.com.

Eric Charles (GMail)

unread,
Apr 19, 2013, 6:28:30 AM4/19/13
to google-s...@googlegroups.com
The easiest would be that you provide a have a small repo to checkout to
test your config and maybe provide a fix to map your goal.

For a pure jsp templating system, apache tiles or sitemesh?
(I hope we don't confuse here the sitebricks templating system with the
pure jsp templating taglibs)

Thx, Eric

On 19/04/2013 11:18, Dirk Vranckaert wrote:
> I must correct you when you say 'Anyway, even if you have one, the
> template.jsp will not be rendered.'
> In fact it's only the template.jsp that get's rendered. The home.jsp
> does not.
>
> And yes my home.jsp has an at, show and decorated annotation.
>
> I've been looking into that (different templating) also but I don't see
> how I can plug in another templating framework.
> Any help with that?
>
> Kr,
>
> Dirk
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg...@gmail.com>>
> <mailto:eric.umg...@gmail.com>
> <mailto:eric.umg.charles@__gmail.com
> <mailto:eric.umg...@gmail.com>>>
>
>
> Hi Dirk,
>
> sitebricks does not support mixed html/jsp systems.
>
> The jsp rendering template is implemented more like a hack and
> delegates to the jsp compiler the responsibility to compile
> the jsp
> page, so it will not take into consideration the specific
> html (or
> other) template annotations.
>
> That's something you loose, on the other hand, you can use
> any jsp
> taglib and function you like.
>
> About the documentation, jsp support is quite new and I
> will try to
> create a pull-request explaining this.
>
> Thx, Eric
>
>
>
> On 19/04/2013 09:38, dirkvra...@gmail.com
> <mailto:dirkvra...@gmail.com>
> <mailto:dirkvranckaert@gmail.__com
> <mailto:dirkvra...@gmail.com>> wrote:
>
> Hey,
>
> I'm building a web app with sitebricks and until now I
> was just
> using HTML with templating (as explained on the
> sitebricks website).
>
> In the template and pages I use the @ShowIf annotation.
> But now
> that I am converting my pages to JSP's I was wondering if I
> could still use them?
>
> What I'm seeing now is that they just get printed on
> the screen,
> should I do something else maybe?
>
> The JSP usage is not really explained on the website...
>
> Thx for the help!
>
> Dirk
>
>
> --
> You received this message because you are subscribed to a
> topic in
> the Google Groups "Google Sitebricks" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/____topic/google-sitebricks/____KCOr4c9fZyk/unsubscribe?hl=en-____US
> <https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US>
> google-sitebricks+unsubscribe@____googlegroups.com
> <http://googlegroups.com>
> <mailto:google-sitebricks%__2Buns...@googlegroups.com
> <mailto:google-sitebricks%252Buns...@googlegroups.com>__>.
> For more options, visit
> https://groups.google.com/____groups/opt_out
> <https://groups.google.com/__groups/opt_out>
> <https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving emails from
> it, send
>
> an email to google-sitebricks+unsubscribe@__googlegroups.com
> <mailto:google-sitebricks%2Bunsu...@googlegroups.com>.
> For more options, visit
> https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Google Sitebricks" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US
> <https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US>.
> To unsubscribe from this group and all its topics, send an email to
> google-sitebricks+unsubscribe@__googlegroups.com
> <mailto:google-sitebricks%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to google-sitebri...@googlegroups.com.

Dirk Vranckaert

unread,
Apr 19, 2013, 7:45:09 AM4/19/13
to google-s...@googlegroups.com
Yes indeed, with Sitemesh it does work. I can plug it in...

But I have yet another strange thing going on since I'm using the JSP's.

I had this file structure before:
/war/WEB-INF/pages/home.html
/war/WEB-INF/pages/register.html

From the home.html (which is mapped on the root "/" url) I was linking to the url "/user/register".
As long as I was using html it was no problem.

But now I changed all the html pages to jsp (just the namings) and in their classes (Home.java and Register.java) I have changed the show-annotation to also link to /war/WEB-INF/pages/???.jsp (instead of html before).

So the home view loads correctly. From there I still have a link to "/user/register" and clicking that link crashes.
Here part of my java file for Register.java:
@At("/user/register")
@Show("WEB-INF/pages/register.jsp")
public class Register {
private String firstName;
private String lastName;
private String email;


At the end you can find the stacktrace.
If you look at it you see that it is not looking for WEB-INF/pages/register.jsp but instead it looks for /user/WEB-INF/pages/register.jsp

So why the hell did he put the part of my path in front...? And I need the sub-path user!

Here is the stacktrace:

Problem accessing /user/register. Reason:


    Could not include the JSP response for path=WEB-INF/pages/register.jsp

Caused by:

java.lang.RuntimeException: Could not include the JSP response for path=WEB-INF/pages/register.jsp
	at com.google.sitebricks.compiler.JspTemplateCompiler$1.render(JspTemplateCompiler.java:49)
	at com.google.sitebricks.routing.WidgetRoutingDispatcher.bindAndRespond(WidgetRoutingDispatcher.java:121)
	at com.google.sitebricks.routing.WidgetRoutingDispatcher.dispatch(WidgetRoutingDispatcher.java:75)
	at com.google.sitebricks.DebugModeRoutingDispatcher.dispatch(DebugModeRoutingDispatcher.java:56)
        ...
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: javax.servlet.ServletException: File &quot;/user/WEB-INF/pages/register.jsp&quot; not found
	at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:335)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
	...
	at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
	at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
	at com.google.sitebricks.compiler.JspTemplateCompiler$1.render(JspTemplateCompiler.java:47)
	... 46 more

Caused by:

javax.servlet.ServletException: File &quot;/user/WEB-INF/pages/register.jsp&quot; not found
	at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:335)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
	at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
	...
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)


Kind Regards,

Dirk Vranckaert
Follow me at Twitter: @dirkvranckaert


2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com>
The easiest would be that you provide a have a small repo to checkout to test your config and maybe provide a fix to map your goal.

For a pure jsp templating system, apache tiles or sitemesh?
(I hope we don't confuse here the sitebricks templating system with the pure jsp templating taglibs)

Thx, Eric


On 19/04/2013 11:18, Dirk Vranckaert wrote:
I must correct you when you say 'Anyway, even if you have one, the
template.jsp will not be rendered.'
In fact it's only the template.jsp that get's rendered. The home.jsp
does not.

And yes my home.jsp has an at, show and decorated annotation.

I've been looking into that (different templating) also but I don't see
how I can plug in another templating framework.
Any help with that?

Kr,

Dirk


2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
        <mailto:eric.umg.charles@gmail.com>
        <mailto:eric.umg.charles@__gmail.com

        <mailto:eric.umg.charles@gmail.com>>>



             Hi Dirk,

             sitebricks does not support mixed html/jsp systems.

             The jsp rendering template is implemented more like a hack and
             delegates to the jsp compiler the responsibility to compile
        the jsp
             page, so it will not take into consideration the specific
        html (or
             other) template annotations.

             That's something you loose, on the other hand, you can use
        any jsp
             taglib and function you like.

             About the documentation, jsp support is quite new and I
        will try to
             create a pull-request explaining this.

             Thx, Eric



             On 19/04/2013 09:38, dirkvra...@gmail.com
        <mailto:dirkvranckaert@gmail.com>
             <mailto:dirkvranckaert@gmail.__com
             <mailto:google-sitebricks%__2Bunsu...@googlegroups.com
        <mailto:google-sitebricks%252Bunsubscribe@googlegroups.com>__>.

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


--
You received this message because you are subscribed to a topic in the Google Groups "Google Sitebricks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to google-sitebricks+unsubscribe@googlegroups.com.

Eric Charles (GMail)

unread,
Apr 19, 2013, 9:17:31 AM4/19/13
to google-s...@googlegroups.com
Hi Dirk,

Good to read sitemesh is working for you.

For the "/user/WEB-INF/pages/register.jsp", this is intrinsect to the
way the request dispatcher work. the page is rendred with
httpRequest.getRequestDispatcher(template.getName());, so if you are in
/user, requesting "WEB-INF/..." will produce "/user/WEB-INF/..."

Can you try prefixing "WEB-INF/..." with a slash ("/WEB-INF/...").

Sorry, no 100% transparent migration from .html to jsp.

+ to answer one of your previous question, the pageFlow attribute is
there to make sitebricks compatible with another web framework I am
using (beehive), but yes, it could be removed (to be discussed).

+ I am not sure the sitebrick 'Template' is the correct description, I
would talk more about 'Rendering', the html/mvel/jsp being responsible
for any further templating (header/footer/sidebar/...).

Thx, Eric
> Follow me at Twitter: @dirkvranckaert <http://twitter.com/dirkvranckaert>
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg...@gmail.com>>
>
> The easiest would be that you provide a have a small repo to
> checkout to test your config and maybe provide a fix to map your goal.
>
> For a pure jsp templating system, apache tiles or sitemesh?
> (I hope we don't confuse here the sitebricks templating system with
> the pure jsp templating taglibs)
>
> Thx, Eric
>
>
> On 19/04/2013 11:18, Dirk Vranckaert wrote:
>
> I must correct you when you say 'Anyway, even if you have one, the
> template.jsp will not be rendered.'
> In fact it's only the template.jsp that get's rendered. The home.jsp
> does not.
>
> And yes my home.jsp has an at, show and decorated annotation.
>
> I've been looking into that (different templating) also but I
> don't see
> how I can plug in another templating framework.
> Any help with that?
>
> Kr,
>
> Dirk
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg.charles@
> <mailto:eric.umg.charles@>__gma__il.com <http://gmail.com>
>
> <mailto:eric.umg.charles@__gmail.com
> <mailto:eric.umg...@gmail.com>>>>
>
>
> Hi Dirk,
>
> sitebricks does not support mixed html/jsp systems.
>
> The jsp rendering template is implemented more
> like a hack and
> delegates to the jsp compiler the responsibility
> to compile
> the jsp
> page, so it will not take into consideration the
> specific
> html (or
> other) template annotations.
>
> That's something you loose, on the other hand, you
> can use
> any jsp
> taglib and function you like.
>
> About the documentation, jsp support is quite new
> and I
> will try to
> create a pull-request explaining this.
>
> Thx, Eric
>
>
>
> On 19/04/2013 09:38, dirkvra...@gmail.com
> <mailto:dirkvra...@gmail.com>
> <mailto:dirkvranckaert@gmail.__com
> <mailto:dirkvra...@gmail.com>>
> <mailto:dirkvranckaert@gmail.
> <mailto:dirkvranckaert@gmail.>____com
>
> <mailto:dirkvranckaert@gmail.__com
> https://groups.google.com/d/______topic/google-sitebricks/______KCOr4c9fZyk/unsubscribe?hl=en-______US
> <https://groups.google.com/d/____topic/google-sitebricks/____KCOr4c9fZyk/unsubscribe?hl=en-____US>
> google-sitebricks+unsubscribe@______googlegroups.com
> <http://googlegroups.com>
> <http://googlegroups.com>
>
> <mailto:google-sitebricks%____2Bun...@googlegroups.com
> <mailto:google-sitebricks%25__2Bun...@googlegroups.com>
>
> <mailto:google-sitebricks%__252Bunsubscribe@googlegroups.__com
> <mailto:google-sitebricks%25252Bun...@googlegroups.com>>__>.
> For more options, visit
> https://groups.google.com/______groups/opt_out
> <https://groups.google.com/____groups/opt_out>
> <https://groups.google.com/____groups/opt_out
> <https://groups.google.com/__groups/opt_out>>
>
> <https://groups.google.com/____groups/opt_out
> <https://groups.google.com/__groups/opt_out>
> <https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>>>.
>
>
>
> --
> You received this message because you are subscribed to
> the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving
> emails from
> it, send
>
> an email to
> google-sitebricks+unsubscribe@____googlegroups.com
> <http://googlegroups.com>
>
>
> <mailto:google-sitebricks%__2Buns...@googlegroups.com
> <mailto:google-sitebricks%252Buns...@googlegroups.com>__>.
> You received this message because you are subscribed to a
> topic in
> the Google Groups "Google Sitebricks" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/____topic/google-sitebricks/____KCOr4c9fZyk/unsubscribe?hl=en-____US
> <https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US>
>
> <https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US
> <https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US>>.
> To unsubscribe from this group and all its topics, send an
> email to
> google-sitebricks+unsubscribe@____googlegroups.com
> <http://googlegroups.com>
> <mailto:google-sitebricks%__2Buns...@googlegroups.com
> <mailto:google-sitebricks%252Buns...@googlegroups.com>__>.
> an email to google-sitebri...@googlegroups.com.

Dirk Vranckaert

unread,
Apr 19, 2013, 9:55:04 AM4/19/13
to google-s...@googlegroups.com
Allright,

thank you very much, it works :-)
I just needed to prefix the WEB-INF/pages/xxx.html with a slash and that did the job.

So with slash-fix and using sitemesh I worked around the short commings of sitebricks for the JSP stuff. Please keep that in mind for the documentation if you write some... :-)
And I needed to update all my EL to prefix the attributes with 'pageFlow.'. Took me a while also before I found out this (accidently found it in the integration-test project...).

With the implementation of sitemesh I also had a small 'issue'. You need to configure a sitemesh filter in the web.xml but I placed it as second filter in the file (after the guice filter), but it should always be the first one in there. Otherwise the pages are not decorated and no error or whatever is logged.

Just starting to think if it's not worth it to write a document describing how to migrate from HTML to JSP (as the HTML setup is well explained and then migration would only take you a few minutes) + how to work around the templating issue with for example sitemesh. I followed this one http://blog.cliffano.com/2009/12/06/sitebricks-and-sitemesh-on-google-app-engine/ and that worked for me.

For the pageFlow attribute, is there a parameter that I can change to remove or rename it? I do not really see why it should be there by default.
I have a paramter userName on my request, I would think that by default you could access it with ${userName} and not ${pageFlow.userName}. Doesn't really make sense. However if you need to have it you should be able to configure it.

Kr,

Dirk


2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com>
Hi Dirk,


    The easiest would be that you provide a have a small repo to
    checkout to test your config and maybe provide a fix to map your goal.

    For a pure jsp templating system, apache tiles or sitemesh?
    (I hope we don't confuse here the sitebricks templating system with
    the pure jsp templating taglibs)

    Thx, Eric


    On 19/04/2013 11:18, Dirk Vranckaert wrote:

        I must correct you when you say 'Anyway, even if you have one, the
        template.jsp will not be rendered.'
        In fact it's only the template.jsp that get's rendered. The home.jsp
        does not.

        And yes my home.jsp has an at, show and decorated annotation.

        I've been looking into that (different templating) also but I
        don't see
        how I can plug in another templating framework.
        Any help with that?

        Kr,

        Dirk


        2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
        <mailto:eric.umg.charles@gmail.com>
        <mailto:eric.umg.charles@__gmail.com

        <mailto:eric.umg.charles@gmail.com>>>


        <eric.umg...@gmail.com <mailto:eric.umg.charles@gmail.com>
                 <mailto:eric.umg.charles@__gmail.com
        <mailto:eric.umg.charles@gmail.com>>
                 <mailto:eric.umg.charles@
        <mailto:eric.umg.charles@>__gma__il.com <http://gmail.com>


                 <mailto:eric.umg.charles@__gmail.com
        <mailto:eric.umg.charles@gmail.com>>>>



                      Hi Dirk,

                      sitebricks does not support mixed html/jsp systems.

                      The jsp rendering template is implemented more
        like a hack and
                      delegates to the jsp compiler the responsibility
        to compile
                 the jsp
                      page, so it will not take into consideration the
        specific
                 html (or
                      other) template annotations.

                      That's something you loose, on the other hand, you
        can use
                 any jsp
                      taglib and function you like.

                      About the documentation, jsp support is quite new
        and I
                 will try to
                      create a pull-request explaining this.

                      Thx, Eric



                      On 19/04/2013 09:38, dirkvra...@gmail.com
        <mailto:dirkvranckaert@gmail.com>
                 <mailto:dirkvranckaert@gmail.__com
        <mailto:dirkvranckaert@gmail.com>>
                      <mailto:dirkvranckaert@gmail.
        <mailto:dirkvranckaert@gmail.>____com


                 <mailto:dirkvranckaert@gmail.__com
          <mailto:google-sitebricks%____2Bunsu...@googlegroups.com
        <mailto:google-sitebricks%25__2Bunsu...@googlegroups.com>

        <mailto:google-sitebricks%__252Bunsubscribe@googlegroups.__com
        <mailto:google-sitebricks%25252Bunsubscribe@googlegroups.com>>__>.

                      For more options, visit
        https://groups.google.com/______groups/opt_out
        <https://groups.google.com/____groups/opt_out>

                 <https://groups.google.com/____groups/opt_out
        <https://groups.google.com/__groups/opt_out>>

                      <https://groups.google.com/____groups/opt_out
        <https://groups.google.com/__groups/opt_out>
                 <https://groups.google.com/__groups/opt_out
        <https://groups.google.com/groups/opt_out>>>.



                 --
                 You received this message because you are subscribed to
        the Google
                 Groups "Google Sitebricks" group.
                 To unsubscribe from this group and stop receiving
        emails from
                 it, send

                 an email to
        google-sitebricks+unsubscribe@____googlegroups.com
        <http://googlegroups.com>



                 For more options, visit
        https://groups.google.com/____groups/opt_out
        <https://groups.google.com/__groups/opt_out>
                 <https://groups.google.com/__groups/opt_out
        <https://groups.google.com/groups/opt_out>>.



             --
             You received this message because you are subscribed to a
        topic in
             the Google Groups "Google Sitebricks" group.
             To unsubscribe from this topic, visit
        https://groups.google.com/d/____topic/google-sitebricks/____KCOr4c9fZyk/unsubscribe?hl=en-____US
        <https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US>

        <https://groups.google.com/d/__topic/google-sitebricks/__KCOr4c9fZyk/unsubscribe?hl=en-__US
        <https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US>>.
             To unsubscribe from this group and all its topics, send an
        email to
             google-sitebricks+unsubscribe@____googlegroups.com
        <http://googlegroups.com>
             <mailto:google-sitebricks%__2Bunsu...@googlegroups.com
        <mailto:google-sitebricks%252Bunsubscribe@googlegroups.com>__>.

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


--
You received this message because you are subscribed to a topic in the Google Groups "Google Sitebricks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-sitebricks/KCOr4c9fZyk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to google-sitebricks+unsubscribe@googlegroups.com.

Eric Charles (GMail)

unread,
Apr 19, 2013, 10:19:09 AM4/19/13
to google-s...@googlegroups.com
On 19/04/2013 14:55, Dirk Vranckaert wrote:
> Allright,
>
> thank you very much, it works :-)
> I just needed to prefix the WEB-INF/pages/xxx.html with a slash and that
> did the job.
>

Cool!

> So with slash-fix and using sitemesh I worked around the short commings
> of sitebricks for the JSP stuff. Please keep that in mind for the
> documentation if you write some... :-)

Doc for JSP is my todo list

> And I needed to update all my EL to prefix the attributes with
> 'pageFlow.'. Took me a while also before I found out this (accidently
> found it in the integration-test project...).
>

Yes, integration-test is the perfect place to start from and see code
snippets.

Sorry for the prefix, I added just to avoid to remove it in all my
jsp... and be backward compatible with my specific implementation.

As I said, this could be changed in the future.

> With the implementation of sitemesh I also had a small 'issue'. You need
> to configure a sitemesh filter in the web.xml but I placed it as second
> filter in the file (after the guice filter), but it should always be the
> first one in there. Otherwise the pages are not decorated and no error
> or whatever is logged.
>

Yes, filter ordering is important in general.

> Just starting to think if it's not worth it to write a document
> describing how to migrate from HTML to JSP (as the HTML setup is well
> explained and then migration would only take you a few minutes) + how to
> work around the templating issue with for example sitemesh. I followed
> this one
> http://blog.cliffano.com/2009/12/06/sitebricks-and-sitemesh-on-google-app-engine/ and
> that worked for me.
>

Thx for the pointer.

> For the pageFlow attribute, is there a parameter that I can change to
> remove or rename it? I do not really see why it should be there by default.
> I have a paramter userName on my request, I would think that by default
> you could access it with ${userName} and not ${pageFlow.userName}.
> Doesn't really make sense. However if you need to have it you should be
> able to configure it.
>

The framework from which I took the idea has some 'page flow' notion: a
bean being active/present in a set of pages + some notion of 'shared
flow' (pages state accessible from any page flow that need it).

If sitebricks comes to support this one day, the pageFlow/sharedFlow
prefix makes sense. Otherwise, that's overhead, yes...

> Kr,
>
> Dirk
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg...@gmail.com>>
>
> Hi Dirk,
>
> Good to read sitemesh is working for you.
>
> For the "/user/WEB-INF/pages/register.__jsp", this is intrinsect to
> the way the request dispatcher work. the page is rendred with
> httpRequest.__getRequestDispatcher(template.__getName());, so if you
> are in /user, requesting "WEB-INF/..." will produce "/user/WEB-INF/..."
>
> Can you try prefixing "WEB-INF/..." with a slash ("/WEB-INF/...").
>
> Sorry, no 100% transparent migration from .html to jsp.
>
> + to answer one of your previous question, the pageFlow attribute is
> there to make sitebricks compatible with another web framework I am
> using (beehive), but yes, it could be removed (to be discussed).
>
> + I am not sure the sitebrick 'Template' is the correct description,
> I would talk more about 'Rendering', the html/mvel/jsp being
> responsible for any further templating (header/footer/sidebar/...).
>
> Thx, Eric
>
>
> On 19/04/2013 12:45, Dirk Vranckaert wrote:
>
> Yes indeed, with Sitemesh it does work. I can plug it in...
>
> But I have yet another strange thing going on since I'm using
> the JSP's.
>
> I had this file structure before:
> /war/WEB-INF/pages/home.html
> /war/WEB-INF/pages/register.__html
>
> From the home.html (which is mapped on the root "/" url) I was
> linking
> to the url "/user/register".
> As long as I was using html it was no problem.
>
> But now I changed all the html pages to jsp (just the namings)
> and in
> their classes (Home.java and Register.java) I have changed the
> show-annotation to also link to /war/WEB-INF/pages/???.jsp
> (instead of
> html before).
>
> So the home view loads correctly. From there I still have a link to
> "/user/register" and clicking that link crashes.
> Here part of my java file for Register.java:
> @At("/user/register")
> @Show("WEB-INF/pages/register.__jsp")
> public class Register {
> private String firstName;
> private String lastName;
> private String email;
>
>
> At the end you can find the stacktrace.
> If you look at it you see that it is not looking for
> WEB-INF/pages/register.jsp but instead it looks for
> /user/WEB-INF/pages/register.__jsp
>
> So why the hell did he put the part of my path in front...? And
> I need
> the sub-path user!
>
> Here is the stacktrace:
>
> Problem accessing /user/register. Reason:
>
>
> Could not include the JSP response for
> path=WEB-INF/pages/register.__jsp
>
>
> Caused by:
>
> java.lang.RuntimeException: Could not include the JSP response
> for path=WEB-INF/pages/register.__jsp
> at
> com.google.sitebricks.__compiler.JspTemplateCompiler$__1.render(JspTemplateCompiler.__java:49)
> at
> com.google.sitebricks.routing.__WidgetRoutingDispatcher.__bindAndRespond(__WidgetRoutingDispatcher.java:__121)
> at
> com.google.sitebricks.routing.__WidgetRoutingDispatcher.__dispatch(__WidgetRoutingDispatcher.java:__75)
> at
> com.google.sitebricks.__DebugModeRoutingDispatcher.__dispatch(__DebugModeRoutingDispatcher.__java:56)
> ...
> at
> org.mortbay.jetty.__HttpConnection.handle(__HttpConnection.java:404)
> at
> org.mortbay.io.nio.__SelectChannelEndPoint.run(__SelectChannelEndPoint.java:__409)
> at
> org.mortbay.thread.__QueuedThreadPool$PoolThread.__run(QueuedThreadPool.java:582)
> Caused by: javax.servlet.__ServletException: File
> &quot;/user/WEB-INF/pages/__register.jsp&quot; not found
> at
> org.apache.jasper.servlet.__JspServlet.__handleMissingResource(__JspServlet.java:335)
> at
> org.apache.jasper.servlet.__JspServlet.serviceJspFile(__JspServlet.java:301)
> at
> org.apache.jasper.servlet.__JspServlet.service(JspServlet.__java:260)
> at
> com.google.appengine.tools.__development.__PrivilegedJspServlet.access$__101(PrivilegedJspServlet.java:__23)
> ...
> at
> com.google.appengine.tools.__development.__DevAppEngineWebAppContext.__handle(__DevAppEngineWebAppContext.__java:94)
> at
> org.mortbay.jetty.servlet.__Dispatcher.include(Dispatcher.__java:192)
> at
> com.google.sitebricks.__compiler.JspTemplateCompiler$__1.render(JspTemplateCompiler.__java:47)
> ... 46 more
>
>
> Caused by:
>
> javax.servlet.__ServletException: File
> &quot;/user/WEB-INF/pages/__register.jsp&quot; not found
> at
> org.apache.jasper.servlet.__JspServlet.__handleMissingResource(__JspServlet.java:335)
> at
> org.apache.jasper.servlet.__JspServlet.serviceJspFile(__JspServlet.java:301)
> at
> org.apache.jasper.servlet.__JspServlet.service(JspServlet.__java:260)
> at
> com.google.appengine.tools.__development.__PrivilegedJspServlet.access$__101(PrivilegedJspServlet.java:__23)
> at
> com.google.appengine.tools.__development.__PrivilegedJspServlet$2.run(__PrivilegedJspServlet.java:59)
> at
> java.security.__AccessController.doPrivileged(__Native Method)
> at
> com.google.appengine.tools.__development.__PrivilegedJspServlet.service(__PrivilegedJspServlet.java:57)
> ...
> at
> org.mortbay.jetty.__HttpConnection.handle(__HttpConnection.java:404)
> at
> org.mortbay.io.nio.__SelectChannelEndPoint.run(__SelectChannelEndPoint.java:__409)
> at
> org.mortbay.thread.__QueuedThreadPool$PoolThread.__run(QueuedThreadPool.java:582)
>
>
>
> Kind Regards,
>
> Dirk Vranckaert
> Follow me at Twitter: @dirkvranckaert
> <http://twitter.com/__dirkvranckaert
> <http://twitter.com/dirkvranckaert>>
>
>
>
> 2013/4/19 Eric Charles (GMail) <eric.umg...@gmail.com
> <mailto:eric.umg...@gmail.com>>>>
> <mailto:eric.umg...@gmail.com>>>
> <mailto:eric.umg.charles@
> <mailto:eric.umg.charles@>
> <mailto:eric.umg.charles@
> <mailto:eric.umg.charles@>>__gm__a__il.com <http://gma__il.com>
> <http://gmail.com>
> <mailto:eric.umg...@gmail.com>>>>>
> <mailto:dirkvranckaert@gmail.
> <mailto:dirkvranckaert@gmail.>____com
> <mailto:dirkvranckaert@gmail.__com
> <mailto:dirkvra...@gmail.com>>>
> <mailto:dirkvranckaert@gmail
> <mailto:dirkvranckaert@gmail>.
> <mailto:dirkvranckaert@gmail
> <mailto:dirkvranckaert@gmail>.>______com
>
>
> <mailto:dirkvranckaert@gmail.
> <mailto:dirkvranckaert@gmail.>____com
> <mailto:dirkvranckaert@gmail.__com
> https://groups.google.com/d/________topic/google-sitebricks/________KCOr4c9fZyk/unsubscribe?__hl=en-______US
> <https://groups.google.com/d/______topic/google-sitebricks/______KCOr4c9fZyk/unsubscribe?hl=en-______US>
>
> <https://groups.google.com/d/______topic/google-sitebricks/______KCOr4c9fZyk/unsubscribe?hl=__en-____US
> <https://groups.google.com/d/____topic/google-sitebricks/____KCOr4c9fZyk/unsubscribe?hl=en-____US>>
>
>
>
> <https://groups.google.com/d/______topic/google-sitebricks/______KCOr4c9fZyk/unsubscribe?hl=__en-____US
> <https://groups.google.com/d/______topic/google-sitebricks/______KCOr4c9fZyk/unsubscribe?hl=__en-____US
> google-sitebricks+unsubscribe@________googlegroups.com
> <http://googlegroups.com>
> <http://googlegroups.com>
> <http://googlegroups.com>
>
>
> <mailto:google-sitebricks%______2Bu...@googlegroups.com
> <mailto:google-sitebricks%25____2Bu...@googlegroups.com>
>
> <mailto:google-sitebricks%25____2Bu...@googlegroups.com
> <mailto:google-sitebricks%2525__2Bu...@googlegroups.com>__>
>
>
> <mailto:google-sitebricks%____252Bunsubscribe@googlegroups.
> <mailto:google-sitebricks%25__252Bunsubscribe@googlegroups.>____com
>
> <mailto:google-sitebricks%__25252Bunsubscribe@__googlegroups.com
> <mailto:google-sitebricks%2525252Bu...@googlegroups.com>>>__>.
> For more options, visit
> https://groups.google.com/________groups/opt_out
> <https://groups.google.com/______groups/opt_out>
> google-sitebricks+unsubscribe@______googlegroups.com
> <http://googlegroups.com>
> <http://googlegroups.com>
>
>
>
> <mailto:google-sitebricks%25252Bun...@googlegroups.com>>__>.
> <mailto:google-sitebricks%25252Bun...@googlegroups.com>>__>.
> For more options, visit
> https://groups.google.com/______groups/opt_out
> <https://groups.google.com/____groups/opt_out>
> <https://groups.google.com/____groups/opt_out
> <https://groups.google.com/__groups/opt_out>>
> <https://groups.google.com/____groups/opt_out
> <https://groups.google.com/__groups/opt_out>
> <https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>>>.
>
>
>
> --
> You received this message because you are subscribed to
> the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving
> emails from
> it, send
> an email to
> google-sitebricks+unsubscribe@____googlegroups.com
> <http://googlegroups.com>
>
> <mailto:google-sitebricks%__2Buns...@googlegroups.com
> <mailto:google-sitebricks%252Buns...@googlegroups.com>__>.
> <mailto:google-sitebricks%__2Buns...@googlegroups.com
> <mailto:google-sitebricks%252Buns...@googlegroups.com>__>.
> an email to google-sitebri...@googlegroups.com.

Eric Charles (GMail)

unread,
Apr 19, 2013, 10:35:24 AM4/19/13
to google-s...@googlegroups.com
... one more on pageFlow...

The bound (instance of the page) is put in the request with
httpRequest.setAttribute("pageFlow", bound);

So we need a name to store that attribute.
The other option would be to get all accessible fields from the 'bound'
and put them one by one in as request attribute, which IMHO a bit too
much code for what it brings.

I also think that we could one day go to other scope (pageFlow,
sharedFlow...).

Thx, Eric
Reply all
Reply to author
Forward
0 new messages