File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Overloaded setter methods in custom tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Overloaded setter methods in custom tag" Watch "Overloaded setter methods in custom tag" New topic
Author

Overloaded setter methods in custom tag

rahull agarwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 31
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

Joined: Jan 10, 2002
Posts: 60774
    
  65

Are the two servers running the exact same servlet container and version of the container?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rahull agarwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 31
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

Joined: Jan 10, 2002
Posts: 60774
    
  65

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

Joined: Jul 20, 2005
Posts: 9930
    
159

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?

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overloaded setter methods in custom tag
 
Similar Threads
Problem in compiling Jsp
Unable to load tag handler class - JSP Exception
Custom tags - setting an attribute using <jsp:attribute>
Problem while Tag lib Up gradation
which is evaluated first my taglib or jstl?