You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Neil B. Cohen" <nc...@verisign.com> on 2007/09/26 13:47:54 UTC

Code directories

I'm brand new to Wicket - trying to see if I can re-design some web 
applications to use this framework. A couple of questions have come up 
right at the beginning - I'll start with the simple one....

1) Code layout - In my existing system, I have code separated into a 
number of different packages - for example,
          com.foo.dm  (data model)
          com.foo.da    (data access)
          com.foo.servlet
          com.foo.util
etc. etc.
Somewhere in the Wicket website, I saw something that said the code had 
to be all in one package. But does that mean pairs of java/html files 
have to be together, or does the entire program have to be in one package?

thanks,

nbc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Code directories

Posted by Gwyn Evans <gw...@gmail.com>.
On Wednesday, September 26, 2007, 12:47:54 PM, Neil <nc...@verisign.com> wrote:

> I'm brand new to Wicket - trying to see if I can re-design some web 
> applications to use this framework. A couple of questions have come up
> right at the beginning - I'll start with the simple one....

> 1) Code layout - In my existing system, I have code separated into a 
> number of different packages - for example,
>           com.foo.dm  (data model)
>           com.foo.da    (data access)
>           com.foo.servlet
>           com.foo.util
> etc. etc.
> Somewhere in the Wicket website, I saw something that said the code had
> to be all in one package. But does that mean pairs of java/html files 
> have to be together, or does the entire program have to be in one package?

It was probably meaning that the Java/HTML pairs should be kept
together[*].  You certainly don't need to keep your program in one
package!

Places to check for info are the main Wicket site, the wicket-examples
linked from there (especially the sources), plus the Wiki.  See the
Documentation Index and the Reference Library pages to start!

/Gwyn

[*] There are ways around this, but we strongly recommend that you
don't consider it until you've got specific reasons not to, beyond the
normal "it seems odd" that everyone has when starting...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Adding a jar file...

Posted by "Neil B. Cohen" <nc...@verisign.com>.
Gwyn Evans wrote:
> On Thursday, September 27, 2007, 12:26:15 PM, Neil <nc...@verisign.com> wrote:
>
>   
>> This question may be as much for Netbeans 6 as for Wicket, but in either
>> case, I'm stumped...
>>     
>
>   
>> I want to add the MySQL jdbc driver to my program so I can connect to a
>> MySQL database. In a regular
>> VWP project in Netbeans 5.5 I would just add the jar file under the 
>> libraries tab. But it doesn't want to let me do that in Netbeans 6. And
>> I don't see how to do it manually in Wicket - how would I identify the
>> driver, and where would I place it so it will be added to the program? I
>> assume it goes somewhere in the pom.xml file, but I'm not sure where to
>> put the actual jar file itself...
>>     
This worked - but only after running mvn install:installfile ... to 
actually load the jar file into the system.

Thanks very much!

nbc

> Try
>
> <dependency>
>     <groupId>mysql</groupId>
>     <artifactId>mysql-connector-java</artifactId>
>     <version>5.0.5</version>
> </dependency>
>
> in the pom file and see what happens? Maybe it'll download it
> automagically when the projects refreshed/reloaded/built...
> (I'm not a NB user)
>
> See http://mvnrepository.com/artifact/mysql/mysql-connector-java for
> how to find the pom fragment.
>
> /Gwyn
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Adding a jar file...

Posted by Gwyn Evans <gw...@gmail.com>.
On Thursday, September 27, 2007, 12:26:15 PM, Neil <nc...@verisign.com> wrote:

> This question may be as much for Netbeans 6 as for Wicket, but in either
> case, I'm stumped...

> I want to add the MySQL jdbc driver to my program so I can connect to a
> MySQL database. In a regular
> VWP project in Netbeans 5.5 I would just add the jar file under the 
> libraries tab. But it doesn't want to let me do that in Netbeans 6. And
> I don't see how to do it manually in Wicket - how would I identify the
> driver, and where would I place it so it will be added to the program? I
> assume it goes somewhere in the pom.xml file, but I'm not sure where to
> put the actual jar file itself...

Try

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.0.5</version>
</dependency>

in the pom file and see what happens? Maybe it'll download it
automagically when the projects refreshed/reloaded/built...
(I'm not a NB user)

See http://mvnrepository.com/artifact/mysql/mysql-connector-java for
how to find the pom fragment.

/Gwyn



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Adding a jar file...

Posted by "Neil B. Cohen" <nc...@verisign.com>.
This question may be as much for Netbeans 6 as for Wicket, but in either 
case, I'm stumped...

I want to add the MySQL jdbc driver to my program so I can connect to a 
MySQL database. In a regular
VWP project in Netbeans 5.5 I would just add the jar file under the 
libraries tab. But it doesn't want to let me do that in Netbeans 6. And 
I don't see how to do it manually in Wicket - how would I identify the 
driver, and where would I place it so it will be added to the program? I 
assume it goes somewhere in the pom.xml file, but I'm not sure where to 
put the actual jar file itself...

I put a similar question to the Netbeans forum last night, but have not 
heard anything yet. If there is a way to add it manually, that would be 
great - at least I can keep working on it....

thanks,

nbc


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Code directories

Posted by "Neil B. Cohen" <nc...@verisign.com>.
Martijn Dashorst wrote:
> On 9/26/07, Neil B. Cohen <nc...@verisign.com> wrote:
>   
>> That makes sense - but if I have data model objects like 'User.java'
>> which are used by multiple pages, then it would seem that all the pages
>> (and all the related data model objects) have to end up in the same
>> package with 'User' - yes? Or am I missing something obvious here...
>>     
>
>   
Got it - thanks to all for the quick replies!

nbc

> If you want to do that sure, but that is not typical. The only thing
> that should be together are the wicket related parts, but they can be
> stored in different packages:
>
> com.example.gui.admin
> com.example.gui.users
> com.example.gui.products
> com.example.gui.products.cheese
> com.example.gui.products.wine
> com.example.gui.products.footballs
>
> Your domain classes can reside wherever you want:
>
> com.example.domain.cheese.french
> com.example.domain.cheese.dutch
>
> They can even come from other JAR files, as long as they are on the classpath.
>
> The only "requirement" for wicket out-of-the-box is to find the markup
> files for pages and panels next to the class files of your java files.
> The easiest way to achieve this is to put the html and java files *for
> your pages* in the same package. That's all.
>
> Martijn
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Code directories

Posted by Martijn Dashorst <ma...@gmail.com>.
On 9/26/07, Neil B. Cohen <nc...@verisign.com> wrote:
> That makes sense - but if I have data model objects like 'User.java'
> which are used by multiple pages, then it would seem that all the pages
> (and all the related data model objects) have to end up in the same
> package with 'User' - yes? Or am I missing something obvious here...

If you want to do that sure, but that is not typical. The only thing
that should be together are the wicket related parts, but they can be
stored in different packages:

com.example.gui.admin
com.example.gui.users
com.example.gui.products
com.example.gui.products.cheese
com.example.gui.products.wine
com.example.gui.products.footballs

Your domain classes can reside wherever you want:

com.example.domain.cheese.french
com.example.domain.cheese.dutch

They can even come from other JAR files, as long as they are on the classpath.

The only "requirement" for wicket out-of-the-box is to find the markup
files for pages and panels next to the class files of your java files.
The easiest way to achieve this is to put the html and java files *for
your pages* in the same package. That's all.

Martijn

-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Code directories

Posted by "Neil B. Cohen" <nc...@verisign.com>.
Martijn Dashorst wrote:
> On 9/26/07, Neil B. Cohen <nc...@verisign.com> wrote:
>   
>> to be all in one package. But does that mean pairs of java/html files
>> have to be together
>>     
>
> Yes, unless you don't want it to, but then you have to resort to other
> tricks (enough examples regarding that on this list).
>
> The easiest way to start learning wicket, imo, is to keep everything
> related to a page, border or panel together in the same package
> directory: .java, .html and .properties
>   

That makes sense - but if I have data model objects like 'User.java' 
which are used by multiple pages, then it would seem that all the pages 
(and all the related data model objects) have to end up in the same 
package with 'User' - yes? Or am I missing something obvious here... It 
seems like the entire program will be contained in one package. That 
isn't the end of the world for me - I just want to be sure I understand 
it...

Thanks -

nbc
>   
>> or does the entire program have to be in one package?
>>     
>
> No (unless you want to)
>
> Martijn
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Code directories

Posted by Martijn Dashorst <ma...@gmail.com>.
On 9/26/07, Neil B. Cohen <nc...@verisign.com> wrote:
> to be all in one package. But does that mean pairs of java/html files
> have to be together

Yes, unless you don't want it to, but then you have to resort to other
tricks (enough examples regarding that on this list).

The easiest way to start learning wicket, imo, is to keep everything
related to a page, border or panel together in the same package
directory: .java, .html and .properties

> or does the entire program have to be in one package?

No (unless you want to)

Martijn

-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org