Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Tags to generate JSP?

Posted on 2005-05-09
6
Medium Priority
?
212 Views
Last Modified: 2013-11-24
Let's say I have the following two tags:

<test:first />
<test:second />

Outputs:

Hello
World!

Is it possible to create a third custom tag that combines the two?

<test:combination />

Outputs:
Hello
World!

It would be nice to be able to do this without resorting to calling the doXXXTag/etc. methods of the respective tag handlers.  Maybe generate the JSP code in the body and somehow ask the container to evaluate it?
0
Comment
Question by:Celedor
  • 3
4 Comments
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13960999
>>Is it possible to create a third custom tag that combines the two?
Yes

>>It would be nice to be able to do this without resorting to calling the doXXXTag/etc. methods of the respective tag handlers.  Maybe generate the JSP code in the body and somehow ask the container to evaluate it?

You can either cut and paste the source for the respective tags or do as you say and call the methods. A

I don't know why you would want to do this as the two tags give you more flexibility and it makes very little difference to have 2 tags rather than 1.

What are you actually trying to do, as I assume that this is a hypothtical example.
0
 

Author Comment

by:Celedor
ID: 13961066
Let's say its a whole bunch of tags, and you don't want to resort to includes.
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 1000 total points
ID: 13961238
Why it's technically possible, I wouldn't want to do it. Say you've got 20 tags to combine. This means that you'd have to re-use the combination tag many times to make it worth while, and as each situation may be different and require a different version of the combination tag I wouldn't recommend it.

You mention that you don't want to use includes. Why not? It's a perfectly good way of getting round the issues of a combined tag and if you used somehting like <c:import> from JSTL you can also pass parameters whch you can then use in your custom tags, allowing greater code re-use.

I can't imagine a sitiuation where it would be advisable, but it's completely up to you and I could be wrong :-)
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 15344205
Agreed
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question