Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Custom Tags

 
Latha Reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to JSP and have some doubt regarding Custom Tags.

Is there any way where we can get the custom tag result into a variable. I have a custom tag already written and I want to slightly manipulate the result based on some conditions.

Thank you very much,

Latha
[ October 06, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Latha.

Please note that I have done you the favor of removing the "URGENT" from your topic title. Be advised that most people here would regard that as rude and ignore your question. (And be honest, was your post really that urgent?)

In order to make best use of the resources here on the Ranch, I would advise you to not use phrases like "urgent" in your posts. The best way to make sure that your questions will get clear and helpful answers is to post clearly worded and thoughtfully asked questions.

bear
Forum bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now on to your question: what exactly do you mean by "custom tag result"?

Am I correct to assume that you wish to populate or create a scripting variable from your tag(s)?
 
Latha Reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, Sorry if I am not following your conventions of posting questions. But truly speaking, I am really looking for some help on this ASAP.

Let me explain my question clearly. I have a custom tag that gives a number(can be 0, +ve, or -ve). Now, I want to display a different text in the jsp page for different numbers that I obtain from the custom tag. How shoud i proceed?

Any help is highly appreciated.

Thanks,
Latha
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using the JSTL? (If not, I highly recommend you do).
 
Latha Reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any more ideas please. I am not sure of JSTL. Is there any other way where I can achieve this.

Thanks

Latha
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it's just a lot easier if you were already using JSTL.

Here's one way:

1) In your tag create a scripting variable and assign it the appropriate value. You can create the variable either via the "variable" declaration in the tag TLD, or with a TEI class. See a Custom Tag tutorial for specifics.

2) Be sure to specify that the scope of the variable is after the tag.

3) In your page use an if then else if then construct to switch between the various options based upon the value of the variable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic