Awesome write up, Andrew! Thanks for sharing your experiences. Martijn
On Tue, Apr 15, 2025 at 12:04 AM andrew goh <gohand...@yahoo.com.invalid> wrote: > Apache Wicket is a very good framework, coming from the spring-boot camp > and picking up the ropes in Apache Wicket. > > I think Apache Wicket is well designed, and probably more so than > various frameworks Spring-framework Spring-boot with all its IOC > containers etc. > > Spring-framework, its MVC architecture and templates are 'easier' to > learn vs Apache Wicket, those are more conventional in the sense of HTML > / JSP (Thymeleaf etc) templates where you script in the templates and > put a MVC Java framework around it. However, as the complexity of web > development evolves, the development progress often becomes rather > repetitive with large amount of HTML intersperse codes, and increasingly > the web starts to look more like an assembly of fragments / components. > > I'd guess it is a reason Javascript frameworks e.g. Angular, React etc > evolved to meet those needs. But that Javascript 'runs in the browser' > and has 'SEO' implications etc. > > Apache Wicket is 'hard to learn' with its architecture and design with > emphasis around reusable Java components an elaborate state tracking to > make stateful pages, is a much needed 'overhaul' to 'conventional' > 'scripting in templates' style of design. > > The state tracking and page cache and 'model' architecture with forms is > practically 'fully built-in', automated, I created a javabean used in a > form in which only part of the fields are represented in the form, but > that all the fields / instance variables are properly transferred even > though I missed out on passing those in the form as hidden fields. e.g. > the id field of the javabean used as primary key in a DB table. > > As I'm intending to run my app possibly in a VPS (cloud servers), I get > pretty paranoid about Apache Wicket's page cache mechanism as a worry is > that a robot can easily load pages and forms many times, create hundreds > to thousands of page versions in the cache eat up available memory and > possibly crash the app. This turn out difficult and I followed the well > written examples using isStateless() to track how each page and its > components are handled > https://nightlies.apache.org/wicket/guide/9.x/single.html#_stateless_pages > (a hint is to log that to a file so that one can examine the log > afterwards to examine which page is stateless and which is not) > After some time, I managed to have a trial app practically run all the > pages stateless including its forms and as I checked, it did not hit the > session for the page cache once all the pages are stateless. But simple > carelessness such as using Link can turn a page into stateful again. The > resorts are to use BookmarkablePagelinks etc, which are stateless. > > After some time and refactoring, it turns out it is possible to design > forms into components and as the page creates it unwraps the reusable > components into the full page including the form, fields, feedbacks, > page decorations etc. The components often summarize otherwise a huge > amount of template htmls into perhaps a single component with <div > wickcet:id="item"> styled components which can unwrap into full blown > codes with components such as fields / inputs + html decorations > etc.This is a big win for forms, especially the complicated ones with > lots of fields. > > I'm still learning the ropes and it is a well designed and trodden > framework, many things still to visit. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Become a Wicket expert, learn from the best: http://wicketinaction.com