cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Gruber <Gabriel.Gru...@workflow.at>
Subject Re: Integration of Wicket Servlet within C2.2 Block with servlet service -> Problem
Date Thu, 11 Oct 2007 16:59:21 GMT
hmm, thanx Daniel that helped.

the url-context correctly redirects to the wicket-servlet. however it 
seems the xhtml wicket tags are not beeing rendered correctly by the 
wicket servlet.

the returned output is:
<?xml version='1.0' encoding='UTF-8'?>
<xhtml>
    <head>
        <title>Wicket Quickstart Archetype Homepage</title>
    </head>
    <body>
        <strong>Wicket Quickstart Archetype Homepage</strong>
        <br/><br/>
        <span wicket:id="message">If you see this message wicket is 
properly configured and running</span>
        <br/><br/>
        Input field:<br/>
        <textarea wicket:id="yourinput" name="yourinput"></textarea>
        <br/>
        <button wicket:id="PressMe" name="PressMe" 
id="PressMe1">Wegschicken</button>
    </body>
</xhtml>

which is actually the unmodified homepage.xml

my wicketpage.java looks like this:

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.WebPage;

/**
 * Homepage
 */
public class HomePage extends WebPage {

        private static final long serialVersionUID = 1L;

        // TODO Add any page properties or variables here

    /**
         * Constructor that is invoked when page is invoked without a 
session.
         * 
         * @param parameters
         *            Page parameters
         */
    public HomePage(final PageParameters parameters) {

        // Add the simplest type of label
        add(new Label("message", "If you see this message wicket is 
properly configured and running"));

 
        // TODO Add your page's components here
        add(new TextArea("yourinput"));
        add(new Button("PressMe"));
    }
 
    public String getMarkupType() {
        return "xml";
    }
}

any ideas?  I recall some guys at the cocoon GT wanted to showcase a 
Wicket integration...

thanx in advance..

gabriel

______________________
Mag. Gabriel Gruber
Senior Consultant
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Workflow EDV GmbH, Dannebergplatz 6/23, A-1030 Wien
mailto:gabriel.gruber@workflow.at
http://www.workflow.at



Daniel Fagerstrom <danielf@nada.kth.se> 
11.10.2007 18:13
Please respond to
dev@cocoon.apache.org


To
dev@cocoon.apache.org
cc

Subject
Re: Integration of Wicket Servlet within C2.2 Block with servlet service 
-> Problem






Gabriel Gruber skrev:
>
> Dear C2.2 Dev-Community!
>
> I just played around with Wicket and wanted to integrate a HelloWorld 
> Wicket application within a C2.2 Block as a servlet service:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns:servlet="http://cocoon.apache.org/schema/servlet"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://cocoon.apache.org/schema/servlet 
> http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
> 
>   <bean id="com.mycompany.block2.service" 
> class="org.apache.cocoon.sitemap.SitemapServlet">
>     <servlet:context mount-path="/block2" 
> context-path="blockcontext:/block2/"/>
>   </bean>
> 
>   <bean id="com.mycompany.block2.wicketapp" 
> class="org.apache.wicket.protocol.http.WicketServlet">
>     <servlet:init-params>
>       <entry key="applicationClassName">
>         <value>com.mycompany.WicketApplication</value>
>       </entry>
>     </servlet:init-params>
>     <servlet:context mount-path="/block2-wicket" 
> context-path="blockcontext:/block2-wicket/"/>
>   </bean>
> 
> </beans>
>
> While this seems generally ok, there seems to be a problem with the 
> spring namespacehandler for the servlet service tags. When i start 
> spring an exception is thrown like this...
> Caused by: 
> org.springframework.beans.factory.BeanDefinitionStoreException: Unable 
> to read spring configurations from classpath*:META-INF/cocoon/spring; 
> nested exception is 
> 
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> *Configuration problem: Cannot locate BeanDefinitionDecorator for 
> element [init-params]*

...
> What is wrong here?
>
> Any suggestions?
The servlet:context element must be the root element of the elements in 
the servlet: namespace. The error message basically sys that there is no 
handler for the servlet:init-params as a  root element.

Modify the above  bean definition to:

  <bean id="com.mycompany.block2.wicketapp" 
class="org.apache.wicket.protocol.http.WicketServlet">
    <servlet:context mount-path="/block2-wicket" 
context-path="blockcontext:/block2-wicket/">
      <servlet:init-params>
        <entry key="applicationClassName">
          <value>com.mycompany.WicketApplication</value>
        </entry>
      </servlet:init-params>
    </servlet:context>
  </bean>

And see if it works.

/Daniel



Mime
View raw message