Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overloaded setter methods in custom tag

 
rahull agarwal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I overload setters in Tags?

Below is a portion of my code. This works perfect in staging but not in production environment.

On staging, the tag loads fine. However, in production, it fails. Looking at the compiled java code for the jsp, I see the differences.

On staging, it is compiled as follows:-
_jspx_th_cw_calendarControl_0.setDate((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${wfn:getTodaysDate()}", java.util.Date.class, (PageContext)_jspx_page_context, _jspx_fnmap_0, false));

However, on production it is compiled as follows:-
_jspx_th_cw_calendarControl_0.setDate((java.util.Date) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${wfn:getTodaysDate()}", java.util.Date.class, (PageContext)_jspx_page_context, _jspx_fnmap_0, false));

Please note that on staging it is casting to java.lang.String (correct). But on production, it is casting to java.util.Date (incorrect).
Since, the function wfn:getTodaysDate() returns a String, the code works on staging but fails on production.

What am I missing?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the two servers running the exact same servlet container and version of the container?
 
rahull agarwal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Are the two servers running the exact same servlet container and version of the container?


Yes. jboss-4.0.5.GA

Infact, the funny part is that if I create two projects on my development box. One using staging codeline and the other using production codeline, I do see differences on my local machine too.

So, we have two different codelines. Development and production codelines. They are both in sych right now. I create two projects on my machine using each of these codelines.

Development codeline works fine. Production codeline compiles that jsp differently and fails.

My question is:- "Is it even possible to overload a setter in Tag"?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tag handlers are classes like any other. You need to stop guessing what might be wrong and find out why you are getting different code generated from two apps built from the same code base.

I'm moving this to the JBoss forum where the JBoss-savvy might be more likely to see this.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I won't be surprised if the difference is the JDK vendor and/or version on both these systems, resulting in the wrong method being picked up. What are the exact versions and vendors of Java on these two instances? Can you post that output?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic