I am totally new to Wicket. I hit upon this thread while trying to look for a solution for the exact problem described by Penn. We have an xml which contains data and html type elements (text, radiobutton etc) which we have to dynamically convert to a html page and bind to server side variables. None of the solutions I looked earlier (jsp, spring etc.) really helped so I was tempted to write my own html element classes, when I remembered reading about Wicket sometime ago.
Its been a while since this thread was posted and are there any "clean" solutions to this in Wicket now ? (i saw a mention of QTI framework). Really appreciate help. Penn wrote: > > > thanks Matthijs, > > Your understanding of the problem is correct, we are trying to generate a > HTML pages at runtime. But the solution proposed is looks quiet > complicated. I guess there is no easy way in Wicket to achieve this. so > still we are not able to get the right solution yet. > > I was thinking on the lines provided by you. If I can generate some > dynamic content using > IMarkupResourceStreamProvider.getMarkupResourceStream(), like for example > a image tag then how am I suppose to add this markup in the > corresponding java class. > > ~Praveen > > > Matthijs Wensveen-2 wrote: >> >> Hello Praveen, >> >> Wouter Huijnink presented something similar to what you need at the >> wicket meetup in Amsterdam. We generate html dynamically from xml, using >> xslt. A component called AutoComponentPanel parses the html and adds >> components to the hierarchy accordingly. This is actually a two-step >> process. The first step is telling wicket you want to supply markup >> yourself instead of letting wicket read it from the corresponding html >> file. You can do this by implementing IMarkupResourceStreamProvider and >> if applicable also IMarkupCacheKeyProvider. Then you need to parse the >> markup stream and add components. >> >> If you're interested I can send the AutoComponentPanel code. It still >> needs some work to make it shine, but we plan to open source it anyway >> as part of a wicket-based QTI framework. >> >> PS. Unfortunately Wouter's slides aren't uploaded yet. >> >> >> Pen wrote: >>> thanks Johan for your reply. I did take look into your slides. >>> >>> We can generate HTML pages, we have no issue with it. But how to display >>> this newly created HTML pages which only exists in memory, there is no >>> physical file. And also to navigate to this new HTML page. >>> >>> For example If I create a simple HTML page at runtime like below >>> test.html. >>> How to display it and navigate to it. As it also requires corresponding >>> test.java. This is simple one. But what if we have wicket:Ids we need >>> construct the Java files with all the action listener also. >>> >>> test.html >>> >>> <html> >>> <body> >>> <h1>Hello world! </h1> >>> </body> >>> <html> >>> >>> >>> ~Praveen >>> >>> >>> >>> Johan Compagner wrote: >>> >>>> Generate on one side the html by a servlet or special template >>>> generator, that reads in your db data and generate the component >>>> structure on the other side. >>>> >>>> Look at he slides i put on of the presentation that i did for the >>>> wicket user group in the netherlands >>>> >>>> 2007/12/4, Pen <[email protected]>: >>>> >>>>> I looked into the example wicketstuff-crud, this is basically in >>>>> memory >>>>> database with basic CRUD operation. this is not what exactly I am >>>>> looking. >>>>> Let me restate the question. We have application where in user can >>>>> create >>>>> a >>>>> webpages using web designer by drag-n-drop where is html elements like >>>>> text, >>>>> image, selection box, combo box and save it in DB. >>>>> It will be Json format parse it to POJO and store in DB. for example >>>>> Image >>>>> object looks like this >>>>> which has got position, style, etc . >>>>> [{"position":({left:60, top:40}), >>>>> "size":({width:100,height:80}), >>>>> "positionTop":40,"positionLeft":60,"sizeWidth":100,"sizeHeight":80, >>>>> "cssClass":"", >>>>> "style":"left:60px;top:40px;width:100px;height:80px;", >>>>> ]}}]}) >>>>> >>>>> Now we need to read from the DB and reconstruct the same Image object >>>>> has >>>>> a >>>>> html page. We can construct the above object with HTML tags. >>>>> But the question is how to display this html pages, since it exists >>>>> only >>>>> in >>>>> memory and also how to navigate to this newly created page. >>>>> >>>>> ~Praveen >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> igor.vaynberg wrote: >>>>> >>>>>> see how wicketstuff-crud does it in wicket-stuff svn >>>>>> >>>>>> -igor >>>>>> >>>>>> >>>>>> On Dec 3, 2007 6:30 PM, Pen <[email protected]> wrote: >>>>>> >>>>>>> I am a new wicker user. We need to construct/generate a HTML page >>>>>>> dynamically at runtime from the HTML elements like image and text. >>>>>>> >>>>> This >>>>> >>>>>>> page only exists in memory(session/cache) and there is no physical >>>>>>> >>>>> file. >>>>> >>>>>>> so >>>>>>> how to generate such page and corresponding java class. How this can >>>>>>> >>>>> be >>>>> >>>>>>> done >>>>>>> for static elements like image and text versus dynamically for form >>>>>>> submit. >>>>>>> Also how to navigate to this newly generated html page. >>>>>>> >>>>>>> ~Praveen >>>>>>> -- >>>>>>> View this message in context: >>>>>>> >>>>>>> >>>>> http://www.nabble.com/How-to-dynamically-generate-HTML-page--tf4940771.html#a14143413 >>>>> >>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>> For additional commands, e-mail: [email protected] >>>>>>> >>>>>>> >>>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/How-to-dynamically-generate-HTML-page--tf4940771.html#a14156946 >>>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>>> >>>> >>> >>> >> >> >> -- >> Matthijs Wensveen >> Func. Internet Integration >> W http://www.func.nl >> T +31 20 4230000 >> F +31 20 4223500 >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > -- View this message in context: http://www.nabble.com/How-to-dynamically-generate-HTML-page--tp14143413p22613704.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
