These are the steps I used:

1. Create a Wicket project with Maven (according to 
http://wicket.apache.org/start/quickstart.html)

mvn archetype:generate -DarchetypeGroupId=org.apache.wicket 
-DarchetypeArtifactId=wicket-archetype-quickstart 
-DarchetypeVersion=6.3.0 -DgroupId=com.mycompany -DartifactId=myproject 
-DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false

2. Generate the eclipse configuration files
mvn eclipse:eclipse -Dwtpversion=2.0

(Note: Following steps are based on the tutorial on Youtube: 
http://www.youtube.com/watch?v=Lr8pxEACVRI)
3. In folder src/main/webapp/WEB-INF, create file beans.xml
(Also in folder src/main/webapp/META-INF, create file beans.xml, 
according to the explanation for this example: 
http://tomee.apache.org/examples-trunk/cdi-basic/README.html)

4. Create a POJO
public class Faculty {
     private List<String> facultyMembers;
     private String facultyName;

     @PostConstruct
     public void initialize() {
         this.facultyMembers = new ArrayList<String>();
         facultyMembers.add("Ian Schultz");
         facultyMembers.add("Diane Reyes");
         facultyName = "Computer Science";
     }

     public List<String> getFacultyMembers() {
         return facultyMembers;
     }

     public String getFacultyName() {
         return facultyName;
     }
}

5. Inject the POJO in HomePage.java and display it.
public class HomePage extends WebPage {
         private static final long serialVersionUID = 1L;

         @Inject
         private Faculty faculty;

         public HomePage(final PageParameters parameters) {
                 super(parameters);

                 if (faculty != null) {
                         add(new Label("cdi", faculty.getFacultyName()));
                 } else {
                         add(new Label("cdi", "Not working!"));
                 }
     }
}

Note, class HomePage is the class for the Wicket homepage, as specified 
below:
public class WicketApplication extends WebApplication
{
         /**
          * @see org.apache.wicket.Application#getHomePage()
          */
         @Override
         public Class<? extends WebPage> getHomePage()
         {
                 return HomePage.class;
         }
}

These are the steps I tried, but when running, "Not working!" is 
displayed on the home page. I debugged it and confirmed that faculty is 
null, which means not injected.

Many thanks for your kind help!
Yuci

On 22/11/2012 06:35, Jean-Louis MONTEIRO [via OpenEJB] wrote:
> Could you provide us with more details?
> Don't see Why it could not work.
> A small hello wield example would be great. We could add it to our 
> current
> examples.
>
> Jlouis
> Le 22 nov. 2012 01:30, "Yuci" <[hidden email] 
> </user/SendEmail.jtp?type=node&node=4658789&i=0>> a écrit :
>
> > As TomEE supports Servlets 3, JSF 2, etc., wonder if it also supports
> > Wicket?
> > (I tried a simple Wicket app but could not get CDI, EBJ etc to work.)
> >
> > Many thanks,
> > Yuci
> >
> >
> >
> > --
> > View this message in context:
> > 
> http://openejb.979440.n4.nabble.com/Possible-to-run-Apache-Wicket-on-TomEE-tp4658784.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://openejb.979440.n4.nabble.com/Possible-to-run-Apache-Wicket-on-TomEE-tp4658784p4658789.html
>  
>
> To unsubscribe from Possible to run Apache Wicket on TomEE?, click 
> here 
> <http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4658784&code=eWdvdS5lYmlAZ21haWwuY29tfDQ2NTg3ODR8LTU3NzQ1NTk0Mw==>.
> NAML 
> <http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>  
>





--
View this message in context: 
http://openejb.979440.n4.nabble.com/Possible-to-run-Apache-Wicket-on-TomEE-tp4658784p4658795.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to