Recently, I'm working on login functionality for a webapp where login form in the header and the user has to stay on the same page after logging in.
In order to solve problem, I have to use Ajax. After couples of days working on the Ajax function, I finally got it work the way I wanted it.
However, I ran into a weird error. The Ajax call is working on IE9 only, not in Firefox nor Chrome!
Here is the screenshot of the log in form.
In IE9, when login button is clicked, the form will fade away, but it stay there in Firefox/Chrome.
After first, I thought there was something wrong with my submit button. I tried several ways to call the submit action/event, but they were not working. The problem persisted.
It turned out the solution is quite simple: prevent default behavior for Ajax needs to be turned off!
For some reason, IE9 turns it off when it recognized JSON object, but Firefox/Chrome require the turning off explicitly to be specified in AJAX call.
After this fix, my AJAX log in form works cross browers like a charm!
Monday, July 29, 2013
BackTrack 5 on Vmware: How to Configure Static IP Address
Just follows these simple steps:
1. Make sure choose Bridge for Networking Setting when setting BackTrack 5 with VMware Player or Workstation.
2. Edit /etc/network/interfaces as follows: (In this tutorial, eth0 is used. It varies depends on your own system).
auto eth0
iface eth0 inet static
address 192.168.1.105
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.13.
3. reboot the BackTrack.
Enjoy your static IP address.
Note: This static IP address is just for your LAN (Local Access Network) such as your home network behind a router. It differs from your public IP as provided by your ISP (Internet Service Provider) such as ATT or Comcast.
1. Make sure choose Bridge for Networking Setting when setting BackTrack 5 with VMware Player or Workstation.
2. Edit /etc/network/interfaces as follows: (In this tutorial, eth0 is used. It varies depends on your own system).
auto eth0
iface eth0 inet static
address 192.168.1.105
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.13.
3. reboot the BackTrack.
Enjoy your static IP address.
Note: This static IP address is just for your LAN (Local Access Network) such as your home network behind a router. It differs from your public IP as provided by your ISP (Internet Service Provider) such as ATT or Comcast.
Friday, July 26, 2013
Spring Security Error: java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter
As trying play around with Spring Security, I run into this weird error.
java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter
After doing some Google research, I found a solution for my problem quite simple: just add the scope for java-servlet-api dependency.
Note: This error occurs when running maven tomcat (mvn tomcat:run)
java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter
After doing some Google research, I found a solution for my problem quite simple: just add the scope for java-servlet-api dependency.
Note: This error occurs when running maven tomcat (mvn tomcat:run)
Monday, July 15, 2013
Code Coverage Emma and Weblogic server
Let's say you need to instrument the code and deploy on the Weblogic server. Everything works fine. You can extract emma ctl after executing some GUI testings and also generate Emma report.
However, as you try to modify some source code (in this example the class OwnerSearchController is modified) and re-instrument with Emma. Everything works fine again, except when you try to generate the report and you got this error:
[report] com.vladium.emma.EMMARuntimeException: [CLASS_STAMP_MISMATCH] runtime version of class [com.mycompany.controller.OwnerSearchController] in the coverage data is not consistent with the version of this class in the metadata, possibly because stale metadata is being used for report generation.
The solution to this problem is quite simple: just shutdown and restart your Weblogic server!
My guess is that for some reason Emma controller still pick up the old code (war file) and throw that error.
However, as you try to modify some source code (in this example the class OwnerSearchController is modified) and re-instrument with Emma. Everything works fine again, except when you try to generate the report and you got this error:
[report] com.vladium.emma.EMMARuntimeException: [CLASS_STAMP_MISMATCH] runtime version of class [com.mycompany.controller.OwnerSearchController] in the coverage data is not consistent with the version of this class in the metadata, possibly because stale metadata is being used for report generation.
The solution to this problem is quite simple: just shutdown and restart your Weblogic server!
My guess is that for some reason Emma controller still pick up the old code (war file) and throw that error.
Monday, July 1, 2013
How to write a custom Spring validator
Recently, I'm working on a project where Strut2 and Spring are integrated. And I have to write a validation, but the challenge is that I couldn't use the strut2 validation framework nor Spring validation bundle since the project obviousely doesn't use Spring MVC.
So I have to write a custom validator that implements the Validator provided by Spring.
So I have to write a custom validator that implements the Validator provided by Spring.
Subscribe to:
Posts (Atom)