This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About TagExtraInfo class?

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m returning member scriptlet as per the following class
package examples;
import javax.servlet.jsp.tagext.*;
public class FooTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData data) {
return new VariableInfo[]
{
new VariableInfo("member",
"String",
true,
VariableInfo.AT_END)

};
}
}
But If I want to return more than one scriptlet than i m returning
then how to do it
Suppose i have to return an additional scriptlet by name count
and class java.lang.Integer;
then how can i do it
Peter Sir can u tell something about it
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
package examples;
import javax.servlet.jsp.tagext.*;
public class FooTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData data)
{
return new VariableInfo[]
{
new VariableInfo("member",
"String",
true,
VariableInfo.AT_END),
new VariableInfo("count
",
"java.lang.Integer",
true,
VariableInfo.AT_END)
};
}
}
I suggest u to learn how to declare arrays.
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i already tried this mr pradeep
it does not compile
so better do not fluke if u donot know
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do I ned a TagExtraInfo class when I can provide variable info in TLD.?
Please someone clarify me
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr. Gavrav. There is little that any one can do to help U. The Code given by me is perfectly valid and will surely work. No doubt abt that.
I have plenty of experince working on custom tags.Looks to me that the JSP container was ur own creation. Plz serously consider my previous suggestion.
Originally posted by Gaurav Chikara:
i already tried this mr pradeep
it does not compile
so better do not fluke if u donot know
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not possible to provide variable info in TLD but u can provide attribute info i.e. name , required or optional etc.TagExtraInfo is required for specifying scripting variable.
Originally posted by shan java:
why do I ned a TagExtraInfo class when I can provide variable info in TLD.?
Please someone clarify me
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could u tell me what compiler error u r getting ? Why have given the variable scope as END.
Originally posted by Gaurav Chikara:
i already tried this mr pradeep
it does not compile
so better do not fluke if u donot know
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pradeep bhat:
It is not possible to provide variable info in TLD
I'm afraid your knowledge is out of date. As of JSP 1.2 it is possible to declare a variable in the TLD (and it was about time too). See the description of the "variable" element on p232 of the spec. The SCWCD covers this new JSP version!
I'd agree that "it does not compile" is not quite enough information to go on...
And please remember everyone: this is supposed to be a friendly place for Java greenhorns Thanks.
- Peter
[ April 25, 2002: Message edited by: Peter den Haan ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so I can directly give my variable info thru TLD and do not need to create a class that extends TagExtraInfo.
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx all of u for ur help
I apologise for anything which seemed rude
I have reached only page 65 of specs thats y was unaware of this new concept
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it mean that we can declare multiple variables without
using TagExtraInfo class
Pradeep have u tried this also?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DTD contains
<!ELEMENT tag (name, tag-class, tei-class?, body-content?, display-name?,
small-icon?, large-icon?, description?, variable*, attribute*, example?) >
Note the '*' after variable ..This means u can have as many as many variable elements as u want..I have not tried this but there is no reason why it won't work in a JSP container that implements spec v1.2
Good Luck!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic