You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ronald Klop <ro...@base.nl> on 2003/06/03 15:10:04 UTC
tag and method overloading
Hello,
Is it possible to overload a method of a tag.
In JSP:
String arg1 = "bla";
int arg2 = 5;
<mytag name="<%= arg1 %>" />
<mytag name="<%= arg2 %>" />
In the class:
public void setName(String s) {
...
}
public void setName(int i) {
...
}
I get errors like: can't find setter method for String.
Is this supported? If yes, are their known pitfalls?
Any pointers to docs about this? Already tried google, but didn't find
anything relevant.
Greetings,
Ronald.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tag and method overloading
Posted by Steven Shand <st...@intrallect.com>.
why not always set a list. If you need to set a single String, just set
a list with one entry.
Steven.
On Tuesday, June 3, 2003, at 02:23 pm, Tim Funk wrote:
> See JSP 1.2 Spec --> JSP.2.13.2.1
>
> -Tim
>
> Ronald Klop wrote:
>> Tim Funk wrote:
>>> No. You'll need to do the conversion yourself.
>> Ok, if I have a tag which can get a String or a List of Strings.
>> Should I make one setter which gets Object as parameter? And than
>> check at runtime for the right types?
>> Are there any guidelines for this?
>> Greetings,
>> Ronald.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tag and method overloading
Posted by Tim Funk <fu...@joedog.org>.
See JSP 1.2 Spec --> JSP.2.13.2.1
-Tim
Ronald Klop wrote:
> Tim Funk wrote:
>
>> No. You'll need to do the conversion yourself.
>
>
> Ok, if I have a tag which can get a String or a List of Strings.
> Should I make one setter which gets Object as parameter? And than check
> at runtime for the right types?
> Are there any guidelines for this?
>
> Greetings,
>
> Ronald.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tag and method overloading
Posted by Ronald Klop <ro...@base.nl>.
Tim Funk wrote:
> No. You'll need to do the conversion yourself.
Ok, if I have a tag which can get a String or a List of Strings.
Should I make one setter which gets Object as parameter? And than check
at runtime for the right types?
Are there any guidelines for this?
Greetings,
Ronald.
>
> -Tim
>
> Ronald Klop wrote:
>
>> Hello,
>>
>> Is it possible to overload a method of a tag.
>>
>> In JSP:
>> String arg1 = "bla";
>> int arg2 = 5;
>> <mytag name="<%= arg1 %>" />
>> <mytag name="<%= arg2 %>" />
>>
>> In the class:
>> public void setName(String s) {
>> ...
>> }
>> public void setName(int i) {
>> ...
>> }
>>
>> I get errors like: can't find setter method for String.
>>
>> Is this supported? If yes, are their known pitfalls?
>> Any pointers to docs about this? Already tried google, but didn't find
>> anything relevant.
>>
>> Greetings,
>>
>> Ronald.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tag and method overloading
Posted by Tim Funk <fu...@joedog.org>.
No. You'll need to do the conversion yourself.
-Tim
Ronald Klop wrote:
> Hello,
>
> Is it possible to overload a method of a tag.
>
> In JSP:
> String arg1 = "bla";
> int arg2 = 5;
> <mytag name="<%= arg1 %>" />
> <mytag name="<%= arg2 %>" />
>
> In the class:
> public void setName(String s) {
> ...
> }
> public void setName(int i) {
> ...
> }
>
> I get errors like: can't find setter method for String.
>
> Is this supported? If yes, are their known pitfalls?
> Any pointers to docs about this? Already tried google, but didn't find
> anything relevant.
>
> Greetings,
>
> Ronald.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org