You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by gilbertoca <gi...@gmail.com> on 2010/07/21 18:37:48 UTC

Re: State of JSP support?

Hi, I'm trying one simple jsp example.
The page is mapped 
[QUOTE]
[Click] [info ] found jar:
file:/home/gilberto/.m2/repository/org/apache/click/click-nodeps/2.2.0/click-nodeps-2.2.0.jar
[Click] [debug] click.xml pages:
[Click] [debug] /secure/users.jsp ->
org.apache.click.extras.security.examples.secure.UserView
[Click] [debug] automapped pages:
[Click] [debug] /click/error.htm -> CLASS NOT FOUND
[Click] [debug] /click/error.htm -> CLASS NOT FOUND
[Click] [debug] /click/not-found.htm -> CLASS NOT FOUND
[Click] [debug] /click/not-found.htm -> CLASS NOT FOUND
[Click] [debug] /index.jsp -> CLASS NOT FOUND
[Click] [debug] /secure/index.jsp -> CLASS NOT FOUND
[Click] [debug] /secure/user-view.jsp -> CLASS NOT FOUND
[Click] [debug] initializing FileLoadService:
org.apache.click.service.CommonsFileUploadService
[Click] [debug] initializing TemplateService:
org.apache.click.service.VelocityTemplateService
[Click] [debug] initializing ResourceService:
org.apache.click.service.ClickResourceService
[Click] [info ] Click 2.2.0 initialized in debug mode
2010-07-21 12:05:44.589:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Console reloading is ENABLED. Hit ENTER on the console to restart the
context.
[/QUOTE]


but when hitting the browser url, for example, 
http://localhost:8080/secure/users.jsp click do nothing.
Switching to http://localhost:8080/secure/users.htm it works.
[QUOTE]
<click-app> 
  <pages package="org.apache.click.extras.security.examples.secure">
      <page path="secure/users.jsp" classname="UserView"/>
  </pages>
  <mode value="debug"/>
</click-app>
[/QUOTE]

Can anyone help?
  
Regards,

Gilberto
-- 
View this message in context: http://click.1134972.n2.nabble.com/State-of-JSP-support-tp1567308p5321812.html
Sent from the click-user mailing list archive at Nabble.com.

Re: State of JSP support?

Posted by Beto <gi...@gmail.com>.
Hi, Bob! I hope it is fine with you!

I was studying the Apache Shiro security framework [1] and using the
Bruce Philips's example [2] which uses jsp, before make an example
using just click features. I've used the wicket shiro integration[3]
as references as well and build something not so professional but
enough to understand a little more about security sites.
I've asked here[4] about a real example and since then I'm trying to
do something really important to every web app: security.

So, theses attempts are here: click orm integration (coi), whick can
be checkout.
svn checkout http://osu.googlecode.com/svn/trunk/click-orm-integration coi

specially the somesecurity example. I know it is not very organized,
but can be a started point.

Regards,

[1]http://incubator.apache.org/shiro/
[2] http://www.brucephillips.name/blog/index.cfm/2009/4/5/An-Introduction-to-Ki-formerly-JSecurity--A-Beginners--Tutorial-Part-2
[3]http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-shiro
[4] https://issues.apache.org/jira/browse/CLK-532

PS.: I'm on vacation and will return until the end of week.

Re: State of JSP support?

Posted by Bob Schellink <sa...@gmail.com>.
On 27/07/2010 23:42, Beto wrote:
>
> One more question: where does it say, in the docs, which control I can
> or can't use with jsp template?

I don't know of such docos, but on the other hand I'm not sure it
won't work. Try the PickList control and see if it renders or not.

Regards
Bob

On Fri, Jul 23, 2010 at 10:24 PM, Bob Schellink <sa...@gmail.com> wrote:
> On 22/07/2010 22:26, Beto wrote:
>>
>> "If you use JSP pages for rendering, the .jsp  extension must be used.
>> For example: "
>>
>> And says that I should use the .jsp extension, but doesn't indicate
>> that I must use the .htm extension in the request url.
>
>
> Ok, I've added a section to the doco that jsp templates are accessed using the htm extension.
>
> "Please note, Click does not handle JSP requests directly, instead it forwards JSP requests to the
> servlet container. Do not map the ClickServlet to handle *.jsp requests in web.xml. Instead .jsp
> templates are accessed with a .htm  extension. At runtime Click will convert the page path from .jsp
> to .htm and back."
>
> Kind regards
>
> Bob
>

Re: State of JSP support?

Posted by Beto <gi...@gmail.com>.
On Fri, Jul 23, 2010 at 9:24 AM, Bob Schellink <sa...@gmail.com> wrote:
> On 22/07/2010 22:26, Beto wrote:
>>
>> "If you use JSP pages for rendering, the .jsp  extension must be used.
>> For example: "
>>
>> And says that I should use the .jsp extension, but doesn't indicate
>> that I must use the .htm extension in the request url.
>
>
> Ok, I've added a section to the doco that jsp templates are accessed using the htm extension.
>
> "Please note, Click does not handle JSP requests directly, instead it forwards JSP requests to the
> servlet container. Do not map the ClickServlet to handle *.jsp requests in web.xml. Instead .jsp
> templates are accessed with a .htm  extension. At runtime Click will convert the page path from .jsp
> to .htm and back."
>

Very good!

One more question: where does it say, in the docs, which control I can
or can't use with jsp template?

Regards,

Gilberto

Re: State of JSP support?

Posted by Bob Schellink <sa...@gmail.com>.
On 22/07/2010 22:26, Beto wrote:
> 
> "If you use JSP pages for rendering, the .jsp  extension must be used.
> For example: "
> 
> And says that I should use the .jsp extension, but doesn't indicate
> that I must use the .htm extension in the request url.


Ok, I've added a section to the doco that jsp templates are accessed using the htm extension.

"Please note, Click does not handle JSP requests directly, instead it forwards JSP requests to the
servlet container. Do not map the ClickServlet to handle *.jsp requests in web.xml. Instead .jsp
templates are accessed with a .htm  extension. At runtime Click will convert the page path from .jsp
to .htm and back."

Kind regards

Bob

Re: State of JSP support?

Posted by Beto <gi...@gmail.com>.
On Wed, Jul 21, 2010 at 10:14 PM, Bob Schellink <sa...@gmail.com> wrote:
> On 22/07/2010 09:27, Beto wrote:
>
>> I know, it is the default. I thought that I would need to change that
>> extension since now I'm using jsp.
>
> So you want to do this?
>
>  <servlet-mapping>
>    <servlet-name>ClickServlet</servlet-name>
>    <url-pattern>*.jsp</url-pattern>
>  </servlet-mapping>
Yes! Did it this way.

> I haven't tested but I think this will cause problems because Click is not a JSP engine and won't be
> able to handle JSP requests directly. What Click does is forward the JSP requests to the >Servlet container.
I'm using Jetty/Tomcat and for common jsp request it isn't forwarding:
BOTH:
Page Not Found
The page you requested was not found.

JETTY
[QUOTE]
[INFO] Started Jetty Server
[INFO] Console reloading is ENABLED. Hit ENTER on the console to
restart the context.
[Click] [debug] GET http://localhost:8080/index.jsp
[Click] [debug] /index.jsp -> CLASS NOT FOUND
[Click] [info ] renderTemplate: /click/not-found.htm - 68 ms
[Click] [info ] handleRequest:  /index.jsp - 93 ms
[/QUOTE]

TOMCAT
[QUOTE]
[Click] [info ] Click 2.2.0 initialized in debug mode
Jul 22, 2010 8:35:12 AM org.apache.catalina.core.StandardContext start
INFO: Container
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/basic-shiro-jsp-0.0.1-SNAPSHOT]
has already been started
[Click] [debug] GET http://localhost:8080/basic-shiro-jsp-0.0.1-SNAPSHOT/
[Click] [debug] /index.jsp -> CLASS NOT FOUND
[Click] [info ] renderTemplate: /click/not-found.htm - 18 ms
[Click] [info ] handleRequest:  /index.jsp - 45 ms
[/QUOTE]

>If you apply the mapping above Click will forward the request unto itself and go into a
> recursive loop.
>
> Can you confirm whether this is true?

Yes!

[QUOTE]
HTTP ERROR 500

Problem accessing /secure/users.jsp. Reason:

    Server Error

Caused by:

java.lang.StackOverflowError
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:457)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
	at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:471)
[/QUOTE]
>
>
>>> Even if the  template is a JSP, you still access the URL via .htm. Click will automatically >>check whether the template is a HTM or JSP and change the extension accordingly.
>>
>> I didn't find this information in your reference [1].
>> Where, in the docs, can I find more about setting up jsp in click?
>
>
> There is some docs on JSP here: http://click.apache.org/docs/user-guide/html/ch02.html
Here, as well doesn't have much information:

"If you use JSP pages for rendering, the .jsp  extension must be used.
For example: "

And says that I should use the .jsp extension, but doesn't indicate
that I must use the .htm extension in the request url.

Regards,

Gilberto

Re: State of JSP support?

Posted by Bob Schellink <sa...@gmail.com>.
On 22/07/2010 09:27, Beto wrote:

> I know, it is the default. I thought that I would need to change that
> extension since now I'm using jsp.

So you want to do this?

  <servlet-mapping>
    <servlet-name>ClickServlet</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>ClickServlet</servlet-name>
    <url-pattern>*.htm</url-pattern>
  </servlet-mapping>

I haven't tested but I think this will cause problems because Click is not a JSP engine and won't be
able to handle JSP requests directly. What Click does is forward the JSP requests to the Servlet
container. If you apply the mapping above Click will forward the request unto itself and go into a
recursive loop.

Can you confirm whether this is true?


>> Even if the  template is a JSP, you still access the URL via .htm. Click will automatically check whether the
>> template is a HTM or JSP and change the extension accordingly.
> 
> I didn't find this information in your reference [1].
> Where, in the docs, can I find more about setting up jsp in click?


There is some docs on JSP here: http://click.apache.org/docs/user-guide/html/ch02.html



>>
>> What is the reason you want to access the url via *.jsp?
> It seems intuitive, no? Veloctiy -> htm; JSP -> jsp


Sure, but as I explained above this might cause an infinite loop as Click forwards JSP requests unto
itself.

Regards

Bob

Re: State of JSP support?

Posted by Beto <gi...@gmail.com>.
>
> This is correct. By default ClickServlet handles requests with *.htm extensions[1].

I know, it is the default. I thought that I would need to change that
extension since now I'm using jsp.

> Even if the  template is a JSP, you still access the URL via .htm. Click will automatically check whether the
> template is a HTM or JSP and change the extension accordingly.

I didn't find this information in your reference [1].
Where, in the docs, can I find more about setting up jsp in click?

>
> What is the reason you want to access the url via *.jsp?
It seems intuitive, no? Veloctiy -> htm; JSP -> jsp

So, whats matter for the default ClickServlet is the htm extension?

> Regards
>
> Bob
>
> [1]: http://click.apache.org/docs/user-guide/html/ch04.html#servlet-configuration
>

Re: State of JSP support?

Posted by Bob Schellink <sa...@gmail.com>.
On 22/07/2010 02:37, gilbertoca wrote:
> 
> but when hitting the browser url, for example, 
> http://localhost:8080/secure/users.jsp click do nothing.
> Switching to http://localhost:8080/secure/users.htm it works.


This is correct. By default ClickServlet handles requests with *.htm extensions[1]. Even if the
template is a JSP, you still access the URL via .htm. Click will automatically check whether the
template is a HTM or JSP and change the extension accordingly.

What is the reason you want to access the url via *.jsp?

Regards

Bob

[1]: http://click.apache.org/docs/user-guide/html/ch04.html#servlet-configuration