473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

JSP TLD question: why my custom tag isn't picking up the ${param.product} parameter?

Hi, thanks in advance for any help you can offer me.

I'm wrestling with the following problem:

The following is on the same jsp page and say that the product
parameter is "foo":

// This works fine, and results in 'foo' being written:
<c:out value="${param.product}" />

// This does not, it results in '${param.product}' being written
// (the quickOrder tag is just writing the value back, at the moment):
<common_tags:quickOrder product="${param.product}" />

Do you have any idea why the param.product in my custom tag is not
being converted into the value 'foo'?

(c:out is a jakarta-taglibs\standard-1.0 tag, and I'm running this on
JRun4; the TLD for both the apache taglibs and for my custom tag are
in the appropriate place -- below I've attached the relavent portion
of the tld if you need to see it).

Best,

Tom

-----

<tag>
<name>quickOrder</name>
<tagclass>mytags.QuickOrder</tagclass>
<body-content>JSP</body-content>
<attribute>
<name>product</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
Jul 17 '05 #1
2 7036
If it's not an EL, does it work pefect?

tf*****@math.luc.edu (Thomas P. Fuller) wrote in message news:<ff**************************@posting.google. com>...
Hi, thanks in advance for any help you can offer me.

I'm wrestling with the following problem:

The following is on the same jsp page and say that the product
parameter is "foo":

// This works fine, and results in 'foo' being written:
<c:out value="${param.product}" />

// This does not, it results in '${param.product}' being written
// (the quickOrder tag is just writing the value back, at the moment):
<common_tags:quickOrder product="${param.product}" />

Do you have any idea why the param.product in my custom tag is not
being converted into the value 'foo'?

(c:out is a jakarta-taglibs\standard-1.0 tag, and I'm running this on
JRun4; the TLD for both the apache taglibs and for my custom tag are
in the appropriate place -- below I've attached the relavent portion
of the tld if you need to see it).

Best,

Tom

-----

<tag>
<name>quickOrder</name>
<tagclass>mytags.QuickOrder</tagclass>
<body-content>JSP</body-content>
<attribute>
<name>product</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

Jul 17 '05 #2

"Thomas P. Fuller" <tf*****@math.luc.edu> wrote in message
news:ff**************************@posting.google.c om...
Hi, thanks in advance for any help you can offer me.

I'm wrestling with the following problem:

The following is on the same jsp page and say that the product
parameter is "foo":

// This works fine, and results in 'foo' being written:
<c:out value="${param.product}" />

// This does not, it results in '${param.product}' being written
// (the quickOrder tag is just writing the value back, at the moment):
<common_tags:quickOrder product="${param.product}" />

Do you have any idea why the param.product in my custom tag is not
being converted into the value 'foo'?

(c:out is a jakarta-taglibs\standard-1.0 tag, and I'm running this on
JRun4; the TLD for both the apache taglibs and for my custom tag are
in the appropriate place -- below I've attached the relavent portion
of the tld if you need to see it).

Best,

Tom

-----

<tag>
<name>quickOrder</name>
<tagclass>mytags.QuickOrder</tagclass>
<body-content>JSP</body-content>
<attribute>
<name>product</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>


Looks like your custom tag doesn't support expression language. EL support
has to be coded into your tag handler, it's not magically provided by
default unfortunately. Either use standard jsp <%= someValue %> to provide
the value, or add in EL support.

First of all you'll need to set rtexprvalue = false in the TLD. Then your
setProduct method will look something like this:

public void setProduct(String value) throws JspException {
try {
product = (Clazz) ExpressionUtil.evalNotNull(
"quickOrder",
"product",
value,
Clazz.class,
this,
pageContext);
} catch (NullAttributeException ex) {
product = null;
}
}

Where Clazz is the class you're expecting to return. You'll need to add the
JSTL jar to your path if it isn't there already, and import

import org.apache.taglibs.standard.tag.common.core.NullAt tributeException;
import org.apache.taglibs.standard.tag.el.core.Expression Util;

Let me know how it goes :-)



Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: readytohelp | last post by:
I have the following XML <root> <Companies> <Name>Labs</Name> <display>Labs </display> <val>1</val> <Products> <val>1</val> <display>Maxa</display> <CompanyKey>1</CompanyKey>
1
by: readytohelp | last post by:
I have the following XML <root> <Companies> <Name>Labs</Name> <display>Labs </display> <val>1</val> <Products> <val>1</val> <display>Maxa</display> <CompanyKey>1</CompanyKey>
1
by: Scott | last post by:
The following is the XML I have to work with. Below is the question <Table0> <CaseID>102114</CaseID> <CaseNumber>1</CaseNumber> <DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>...
33
by: John Timbers | last post by:
I'd like to purchase Visual C# .Net for learning purposes only since it's a lot cheaper than Visual Studio (note that I'm a very experienced C++ developer). Can someone simply clarify the basic...
4
by: Ben Blair | last post by:
Hi. How does one assign a custom parameter attribute to the implicit "value" parameter of the set accessor method of a property? For example, I can assign a custom attribute to the return...
3
by: Ryan Moore | last post by:
I am trying to "tune" some user controls in ASP.NET for optimal caching. Is it possible to do a vary by param - on a Session Variable, so the page caches when a Session variable stays the same,...
5
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze...
0
by: john_teague | last post by:
I appologize for the cross-posting, but I received no responses from the building controls group. I have a custom control that inherits from a DataGrid control. I have a property that has an...
1
by: V | last post by:
Hello! I made custom control with tables and labels in it. In my page I have several of these controls. Each one should have different color of tables etc. I have different SkinIDs for that....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.