Hi,
Just came across a problem, where I was not able to hide a text field on a DropDown Change event.
On the onChange event of the dropdown i was doing the following :
myDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
myTxtField.clearInput();
myTxtField.setModelObject("");
myTxtField.setEnabled(false);
myTxtField.setVisible(false);
target.addComponent(myTxtField);
}
});
Solution:
I added the following line in the onUpdate method and it worked:
myTxtField.setOutputMarkupPlaceholderTag(true);
The SetOutputMarkupPlaceholder() method helps to re-render the wicket components.
Thanks,
Sanjay Ingole
Friday, December 31, 2010
Sunday, December 19, 2010
Wicket : Unable to re-submit the form after the form errors
I was working on a login form where two fields were used as usual i.e. login id and password.
I used a form with an AjaxSubmitLink and overrode its onSubmit and onError methods.
I did not use the FeedbackPanel on the form as I used custom labels with some style to show the errors.
in the onError overridden method I did the following :
passwordError.setDefaultModelObject(
I used a form with an AjaxSubmitLink and overrode its onSubmit and onError methods.
I did not use the FeedbackPanel on the form as I used custom labels with some style to show the errors.
in the onError overridden method I did the following :
protected void onError(final AjaxRequestTarget target, final Form form) {
if(userEmail.getFeedbackMessage() != null) {
invalidEmailLabel.setDefaultModelObject(
userEmail.getFeedbackMessage().getMessage().toString());
invalidEmailLabel.setOutputMarkupPlaceholderTag(true);
}
if(userPassword.getFeedbackMessage() != null) {
userPassword.getFeedbackMessage().getMessage().toString());
passwordError.setDefaultModelObject(
userPassword.getFeedbackMessage().getMessage().toString());
loginErrorMessage.setVisible(false);
}
userPassword.clearInput();
userPassword.setModelObject("");
form.add(userPassword);
target.addComponent(form);
}
};
This code looks fine. But I faced one issue - After the page is loaded for the first time, If I enter correct data it works fine but as soon as I input the invalid values, the form validation fails and form error occurs. Which is an expected behavior but then again if I give the correct values and try to submit the form, it doest pass me through. I played with ajax a lot but coud not find the solution.
Then I found the cleanupFeedbackMessages() method by doing some search, but in my custom session I had an empty implementation of cleanupFeedbackMessages(), as my custom session extended org.apache.wicket.Session.
I changed my session's parent class to org.apache.wicket.protocol.http.WebSession; which does not require to override the cleanupFeedbackMessages() method.
Then in my onError method I called the following which solved my problem.
getSession().cleanupFeedbackMessages();
This method saved my life,My ajax implementation worked fine as expected. I was almost going to implement it on page load event. But could not compromise with what I desired.
Finally somebody has said it correctly : "Where is the will , there is the way."
Let me know if this info helped you.
Thanks,
Sanjay :)
Friday, December 17, 2010
Unable to broadcast webcam with yahoo messanger on my macbook
Hi
I had a problem using my built-in webcam on macbook while using yahoo messenger, whereas it was working fine with gtalk. I did following to fix the problem and it worked.
Open Yahoo messenger-> Open Preferences -> WebCam -> Video
There is a drop-down called - Video Source with values :
-Google Camera Adapter 0
-Google Camera Adapter 1
-Built-In iSight
In my case Google Camera Adapter 0 was set by default. I changed it to - Built-In iSight.
Then closed the camera and reopened. It solved my problem :)
Just thought it be helpful for somebody who is facing the same problem.
Regards,
Sanjay
I had a problem using my built-in webcam on macbook while using yahoo messenger, whereas it was working fine with gtalk. I did following to fix the problem and it worked.
Open Yahoo messenger-> Open Preferences -> WebCam -> Video
There is a drop-down called - Video Source with values :
-Google Camera Adapter 0
-Google Camera Adapter 1
-Built-In iSight
In my case Google Camera Adapter 0 was set by default. I changed it to - Built-In iSight.
Then closed the camera and reopened. It solved my problem :)
Just thought it be helpful for somebody who is facing the same problem.
Regards,
Sanjay
Thursday, October 21, 2010
Cannot find the declaration of element 'beans'.
I was getting following exceptions :
servers/AdminServer/tmp/_WL_user/core-app/m7r7rm/war/WEB-INF/lib/custom.core-Proj-1.9.0.jar!/conf/spring/dataaccess/openjpa/
njpa.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaratio
an be found for element 'util:list'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
Truncated. see log file for complete stacktrace
org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:list'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
Truncated. see log file for complete stacktrace
>
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:975)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:361)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
Truncated. see log file for complete stacktrace
org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:list'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
Truncated. see log file for complete stacktrace
java.lang.NoClassDefFoundError: org/apache/renamed/openjpa/util/ImplHelper
at org.apache.renamed.openjpa.conf.OpenJPAConfigurationImpl.preClose(OpenJPAConfigurationImpl.java:1439)
at org.apache.renamed.openjpa.jdbc.conf.JDBCConfigurationImpl.preClose(JDBCConfigurationImpl.java:852)
at org.apache.renamed.openjpa.lib.conf.ConfigurationImpl.close(ConfigurationImpl.java:347)
at org.apache.renamed.openjpa.kernel.AbstractBrokerFactory.close(AbstractBrokerFactory.java:399)
at org.apache.renamed.openjpa.kernel.DelegatingBrokerFactory.close(DelegatingBrokerFactory.java:183)
For this issue I checked for Spring version it was 2.0 in my application where in the spring configuration file it was mentioned as 3.0
I just changed the following from
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
to this
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
It fixed the issue.
Tuesday, October 12, 2010
Invoke a javascript post Ajax call
I had a requirement where I had to invoke a javascript method after the ajax call.
I used the following method at the end of tht html.
It resolved the issue.
I used the following method at the end of tht html.
It resolved the issue.
<script type="text/javascript"> Wicket.Ajax.registerPostCallHandler(function() { dummyMethod(); }); </script>
Subscribe to:
Posts (Atom)