Re: Example of pseudo-ajax file uploading using iframes
I have confirmed that the code attached is working great!!! (the attachment is in tar. gzip format. use 7-zip) THANK YOU CARLO! The code is awesome. This feature been bugging for the last week or so. The php side have long been able to do this with their frameworks (using the same technique I believe). This piece should be in the extension package. Thanks again. Carlos Pita-4 wrote: Hi all, here is a hopefully functional example showing how to use an iframe to upload a file and afterwards call a behavior on a component belonging to the top frame, so that an ajax action could be carried on in consequence (maybe to get rid of the iframe, or to show an informative message, or whatever). This is along the same venue as other examples that are around the web, like http://www.air4web.com/files/upload/. I don't have the time to write a proper wiki page just right now, so I simply attach the example here. Hope it helps. Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Example-of-pseudo-ajax-file-uploading-using-iframes-tp12400088p20120038.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]
Ajax refresh custom WebComponent fail (an external image by Igor Vaynberg)
I'm trying to refresh a custom components describe in http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html . It's an External image wrapped in a link (clickable image) nbsp; The StaticImage part works great. Minor difference:nbsp; Instead of wrapping in ExternalLink, I just wrap it in Link to opened in a popup, and the popup calls back the page's function with ajaxrequest. WIth the requestTarget, one would think it should be able to ajax refresh the component. Ive tried Component.replaceWith(newComponent) by creating a new StaticImage Component, no luck. I've tried changing the Model, the model and/or URL got changed, but the image refused to refresh no matter what. Next I'm tempted to just try and wrap all this in a Panel and do a replaceWith and see, but this is heavy and I try not to do that. If there are other options I'd glad to try out. Thanks The StaticImage class: public class StaticImage extends WebComponent { nbsp;nbsp; private static final long serialVersionUID = -7600332611457262341L; nbsp;nbsp; public StaticImage(String id, IModel model) nbsp;nbsp; { nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; super(id, model); nbsp;nbsp; } nbsp; nbsp;nbsp; public void resetDefaultModelObject (String url) nbsp;nbsp; { nbsp;nbsp;nbsp; nbsp;nbsp; setDefaultModelObject(new Model(url)); nbsp;nbsp; } nbsp;nbsp; protected void onComponentTag(ComponentTag tag) nbsp;nbsp; { nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; checkComponentTag(tag, img); nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; super.onComponentTag(tag); nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; String url = getDefaultModelObjectAsString(); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; url = url + ((url.indexOf(?) gt;= 0) ? amp; : ?); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; url = url + wicket:antiCache= + System.currentTimeMillis(); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; tag.put(src, url); nbsp;nbsp; } } The code to create the StaticImage nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; ... nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImg = new StaticImage (mainImg,new Model(http://img519.imageshack.us/test1.gif;)); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImg.setOutputMarkupId(true); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgDiv = new WebMarkupContainer(mainImgDiv); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgDiv.setOutputMarkupId(true); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgUploadLink = new Link(mainImgUpload) nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; { nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; public void onClick() nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; { nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; setResponsePage(new PopupPage(CurrentPanel.this)); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; } nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; }; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgUploadLink.setOutputMarkupId(true); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgUploadLink.add(mainImg); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; mainImgDiv.add(mainImgUploadLink); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; panelForm.add(mainImgDiv); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; ... The code to refresh public void onPopupClose (AjaxRequestTarget target) nbsp;nbsp;nbsp; { nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; if (mainImgFile != null) nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; { nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; String newImg = http://img519.imageshack.us/newtest.gif;; nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp; mainImg.resetDefaultModelObject(newImg); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; target.addComponent(newImgComp); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; target.addComponent(mainImgUploadLink); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; target.addComponent(mainImgDiv); nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; } nbsp;nbsp;nbsp; } Any help would be greatly appreciated. Thanks. -- View this message in context: http://www.nabble.com/Ajax-refresh-custom-WebComponent-fail-%28an-external-image-by-Igor-Vaynberg%29-tp20066916p20066916.html Sent from the Wicket - User mailing list archive at Nabble.com.
upgraded to 1.4m3 SpringComponentInjector exception
Hi, I have a small webapp in dev. Been working good in 1.3.4. I just tried it out with 1.4m3 today, and is throwing a spring error. I notice now the annotat package are incorporated into the spring package, but that shouldn't affect the webapp. Here is the Exception: ebApplicationContext(204) | Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT] INFO - ContextLoader.initWebApplicationContext(209) | Root WebApplicationContext: initialization completed in 7890 ms Sep 17, 2008 4:57:59 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter SecWebApplication java.lang.NoSuchMethodError: org.apache.wicket.MetaDataKey: method init()V not found at org.apache.wicket.spring.injection.annot.SpringComponentInjector$1.init(SpringComponentInjector.java:56) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.clinit(SpringComponentInjector.java:53) at com.cookwok.http.web.SecWebApplication.init(SecWebApplication.java:60) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:561) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) - Here is the application class extends webapplication: public final class SecWebApplication extends WebApplication { public SecWebApplication() { } public Class getHomePage() { return SecSignIn.class; } protected void init() { addComponentInstantiationListener(new SpringComponentInjector(this)); configure(); .. Here is my web.xml: ?xml version=1.0 encoding=UTF-8? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 display-namecookwok/display-name !-- [INSERT FRAGMENT HERE] -- !-- Define the basename for a resource bundle for I18N -- context-param param-namejavax.servlet.jsp.jstl.fmt.localizationContext/param-name param-valuemessages/param-value /context-param context-param param-nameconfiguration/param-name param-valuedevelopment/param-value /context-param filter filter-nameSecWebApplication/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationClassName/param-name param-valuecom.cookwok.http.web.SecWebApplication/param-value /init-param init-param param-nameconfiguration/param-name param-valuedevelopment/param-value /init-param load-on-startup1/load-on-startup /filter filter-mapping filter-nameSecWebApplication/filter-name url-pattern/app/*/url-pattern /filter-mapping filter
Re: upgraded to 1.4m3 SpringComponentInjector exception
Ops, thanks. I used MyEclipse's builtin tomcat for test deployment, and even I took out all the jars and changed build-path and does redeploy, it doesn't change the jar automagically within the .metadata/eclipse.Tomcat/webapp . You'd think that eclipse does check if the deploy dest has the jar files that specified in project build path. A big cleanup works now. King Of All Germans wrote: I know.Our mails crossed in the ether. (-; On Wed, Sep 17, 2008 at 6:42 PM, James Carman [EMAIL PROTECTED]wrote: That's kinda what I was gettin' at. :) On Wed, Sep 17, 2008 at 9:37 PM, King Of All Germans [EMAIL PROTECTED] wrote: I got this error when I upgraded from 1.3 to 1.4.In my case, the reason was that I had placed the new wicket jars into the WEB-INF/lib directory, but had accidentally not removed all of the old ones. On Wed, Sep 17, 2008 at 6:27 PM, James Carman [EMAIL PROTECTED]wrote: What's in your WEB-INF/lib folder? Do you have conflicting versions of the SpringComponentInjector? Are you using maven? If so, try mvn dependency:tree or mvn dependency:list to see what your classpath looks like. On Wed, Sep 17, 2008 at 8:05 PM, bryan0101 [EMAIL PROTECTED] wrote: Hi, I have a small webapp in dev. Been working good in 1.3.4. I just tried it out with 1.4m3 today, and is throwing a spring error. I notice now the annotat package are incorporated into the spring package, but that shouldn't affect the webapp. Here is the Exception: ebApplicationContext(204) | Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT] INFO - ContextLoader.initWebApplicationContext(209) | Root WebApplicationContext: initialization completed in 7890 ms Sep 17, 2008 4:57:59 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter SecWebApplication java.lang.NoSuchMethodError: org.apache.wicket.MetaDataKey: method init()V not found at org.apache.wicket.spring.injection.annot.SpringComponentInjector$1.init(SpringComponentInjector.java:56) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.clinit(SpringComponentInjector.java:53) at com.cookwok.http.web.SecWebApplication.init(SecWebApplication.java:60) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:561) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) - Here is the application class extends webapplication: public final class SecWebApplication extends WebApplication { public SecWebApplication() { } public Class getHomePage() { return SecSignIn.class; } protected void init() { addComponentInstantiationListener(new SpringComponentInjector(this)); configure
In appfuse example, UserForm instantiate static abstract inner class ?
I have googled this question in many forms without much success. The problem is I'm trying to understand the appfuse wicket example. And the only thing I'm not getting is the use of private static abstract class inner member class. code public class UserForm extends BasePage { @SpringBean private UserManager userManager; private final Page backPage; public UserForm(Page backPage) { this(backPage, new User()); } public UserForm(final Page backPage, User user) { this.backPage = backPage; // Create and add the form EditForm form = new EditForm(user-form, user) { protected void onSave(User user) { onSaveUser(user); } protected void onCancel() { onCancelEditing(); } protected void onDelete(User user) { onDeleteUser(user); } }; add(form); } ... ... private void onCancelEditing() { setResponsePage(backPage); } private static abstract class EditForm extends Form { private void add(FormComponent fc, IModel label) { . /code Now I understand inner class, static etc etc... But what is the use of abstract in this instant, (all the while instantiating it in enclosing class's constructor. Would it work with just private static class? -- View this message in context: http://www.nabble.com/In-appfuse-example%2C-UserForm-instantiate-static-abstract-inner-class---tp14425471p14425471.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]
Re: In appfuse example, UserForm instantiate static abstract inner class ?
Absolutely... thank you. Gwyn wrote: The point is that in the constructor, you're actually instantiating an anonymous class that *extends* EditForm. It won't work without the abstract, because the onXXX methods are abstract and need implementing. /Gwyn On 19/12/2007, bryan0101 [EMAIL PROTECTED] wrote: I have googled this question in many forms without much success. The problem is I'm trying to understand the appfuse wicket example. And the only thing I'm not getting is the use of private static abstract class inner member class. code public class UserForm extends BasePage { @SpringBean private UserManager userManager; private final Page backPage; public UserForm(Page backPage) { this(backPage, new User()); } public UserForm(final Page backPage, User user) { this.backPage = backPage; // Create and add the form EditForm form = new EditForm(user-form, user) { protected void onSave(User user) { onSaveUser(user); } protected void onCancel() { onCancelEditing(); } protected void onDelete(User user) { onDeleteUser(user); } }; add(form); } ... ... private void onCancelEditing() { setResponsePage(backPage); } private static abstract class EditForm extends Form { private void add(FormComponent fc, IModel label) { . /code Now I understand inner class, static etc etc... But what is the use of abstract in this instant, (all the while instantiating it in enclosing class's constructor. Would it work with just private static class? -- View this message in context: http://www.nabble.com/In-appfuse-example%2C-UserForm-instantiate-static-abstract-inner-class---tp14425471p14425471.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] -- View this message in context: http://www.nabble.com/In-appfuse-example%2C-UserForm-instantiate-static-abstract-inner-class---tp14425471p14428257.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]