Hi

did you solve that issue i have the same problem as you...



Malcolm Edgar-4 wrote:
> 
> Hi Alex,
> 
> what version of Click are you using 1.1?
> 
> regards Malcolm Edgar
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Alexandre
> Jacques
> Sent: Thursday, 22 March 2007 12:06 PM
> To: [email protected]
> Subject: [Click-user] SpringClickServlet
> 
> Hi,
> 
> I am new to Click and I am loving it. I just regret not finding this
> earlier (specially after doing a lot of JSPs!!!). :-)
> 
> I am trying to get Click-Spring integration to work but I just can't.
> Probably is something dumb I am missing. Following my configuration:
> 
> web.xml
> --------------------
> <web-app>
> 
>     <display-name>Click</display-name>
> 
>    <servlet>
>       <servlet-name>click-servlet</servlet-name>
>  
> <servlet-class>net.sf.click.extras.spring.SpringClickServlet</servlet-cl
> ass>
>       <init-param>
>          <param-name>spring-path</param-name>
>          <param-value>/applicationContext.xml</param-value>
>       </init-param>
>       <load-on-startup>0</load-on-startup>
>    </servlet>
> 
>   <servlet-mapping>
>     <servlet-name>click-servlet</servlet-name>
>     <url-pattern>*.htm</url-pattern>
>   </servlet-mapping>
> 
>   <welcome-file-list>
>     <welcome-file>redirect.html</welcome-file>
>   </welcome-file-list>
> 
> </web-app>
> 
> --------------
> 
> SpringPage.java
> ---------------
> 
> public class SpringPage extends Page implements ApplicationContextAware
> {
> 
>     private static final Logger log =
> Logger.getLogger(SpringPage.class);
> 
>     protected ApplicationContext applicationContext;
> 
>     public void setApplicationContext(ApplicationContext
> applicationContext) {
>         this.applicationContext = applicationContext;
>     }
> 
>     public Object getBean(String beanName) {
>         return applicationContext.getBean(beanName);
>     }
> }
> 
> -------------
> 
> BorderPage.java
> --------------
> 
> public class BorderPage extends SpringPage {
> 
>     public String getTemplate() {
>         return "border-template.htm";
>     }
> }
> 
> --------------
> 
> LoginForm.java
> ---------------
> 
> public class LoginForm extends BorderPage {
> 
>     public Form loginForm = new Form("loginForm");
> 
>     private TextField usernameField = new TextField("username");
>     private PasswordField passwordField = new PasswordField("password");
> ...
> }
> 
> All I get, after calling LoginPage.htm is a lousy (if I use
> ClickServlet without Spring, everything works just fine):
> 
> [Click] [error] handleException: java.lang.RuntimeException:
> java.lang.NullPointerException
>         at net.sf.click.ClickServlet.initPage(ClickServlet.java:816)
>         at net.sf.click.ClickServlet.createPage(ClickServlet.java:731)
>         at
> net.sf.click.ClickServlet.handleRequest(ClickServlet.java:355)
>         at net.sf.click.ClickServlet.doGet(ClickServlet.java:280)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
>         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
>         at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:1
> 85)
>         at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>         at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
>         at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
>         at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
>         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>         at org.mortbay.jetty.Server.handle(Server.java:285)
>         at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
>         at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
> ction.java:751)
>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
>         at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
>         at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
>         at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 329)
>         at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.ja
> va:475)
> Caused by: java.lang.NullPointerException
>         at com.showup.click.page.SpringPage.getBean(SpringPage.java:20)
>         at com.showup.click.page.LoginForm.<init>(LoginForm.java:20)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>         at java.lang.reflect.Constructor.newInstance(Unknown Source)
>         at java.lang.Class.newInstance0(Unknown Source)
>         at java.lang.Class.newInstance(Unknown Source)
>         at
> net.sf.click.extras.spring.SpringClickServlet.newPageInstance(SpringClic
> kServlet.java:305)
>         at net.sf.click.ClickServlet.initPage(ClickServlet.java:784)
> 
> Any clues?
> 
> TIA
> Alexandre Jacques
> 
> ------------------------------------------------------------------------
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
> _______________________________________________
> Click-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/click-user
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Click-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/click-user
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/SpringClickServlet-tp1135920p3066735.html
Sent from the click-user mailing list archive at Nabble.com.

Reply via email to