Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

John Hyde

Greenhorn
+ Follow
since Apr 18, 2008
John likes ...
Python Oracle Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Hyde

In a wsdl we define the operation name, input and output in the portType element; later on in binding we define operation, input and output again. What is the rationale behind this? why define them twice? I understand in binding we define the encodingStyle and other attributes, so what is the need of portType?
8 years ago
Having gone through various tutorials on the differences between encoded vs literal, I have found that literal is the recommended option; the tutorials also give various examples of simple services where literal is the logical choice; but I have begun to wonder why the encoded option is there in the first place? Is it something which was added initially to the spec and became deprecated later, is it there only for backward compatibility?
Can you give any real world examples where you would choose encoded over literal
8 years ago

Bear Bibeault wrote:The obvious question is, why would you do that? It's just awful design in my opinion. If you want to pass data to the tag, that's what the attributes are for.

Or are you really asking a more general question about dealing with child elements?



I need to pass a list of values, right now I'm accomplishing this by having two attributes like


I feel passing parameter list is much cleaner
9 years ago
JSP
I'm writing a custom tag using tag files only. I understand that I can read the attributes of a tagfile by <%@attribute name="" %>, but can I read anything which is passed in the tag body?
i.e

I can get the attribute by

but how do I read the param values? is it even possible?
9 years ago
JSP
I have N number of lists of a certain type of object with three attributes (value, description, priority),
pseudo code:


These lists are available to my JSP, where I have to write a html table using them where each list is a column in the html table, with priority being treated as row order. The entries which share the same description in both the lists will be put on the same row, if their priorities don't match max of their priorities will be taken.



To implement this I have an intermediate java method which stitches all the lists into a map like Map<String,Fields[]>
description1 -> [field1 , field2, null , field4]
description2 -> [ null , field2, field3 , field4]


Then I use JSTL to loop through the map to write the table. Though this works, this method does not feel clean. Is there anyway I can use JSTL loops and other JSTL features only to achieve the above functionality without calling an intermediate method to rearrange the data?
9 years ago
JSP

Bear Bibeault wrote:Looking at your original code, I'd create a method in the bean such as getCacheValue() that would perform the work that you are currently doing in the scriptlet, and returns the set of CacheEntry instances as the result.

Then, (assuming you have created the bean with id cacheValueValet) -- see below -- you can simply cause it to be invoked with ${cacheValueValet.cacheValue}. This will evaluate to the Set.

Not only does this eliminate grody scriptlets, it makes the code much more succinct.

The code to create the "valet" (from memory so may need adjusting), would be along the lines of:

In fact, because your code doesn't need the page context at all, you could skip setting it. (Most page helper beans would likely need the context.)



Thanks for the code snippets, but in the end I chose EL functions, they seemed to be even more cleaner
9 years ago
JSP

Bear Bibeault wrote:In fact, here's an abstract class I set up to extend to create a "valet":



Thank you for digging that out, but I don't understand how you go about calling a specific functionality in that new class.
What I understand is.

9 years ago
JSP

Bear Bibeault wrote:What I've done in the past, is to use <jsp:useBean> in the tag (one of the only useful remaining uses for useBean in the post-scriptlet era) and then set the pageContext into the bean so it can have access to the environment. I fancifully called such "helper beans" tag valets.

The <c:set> action is useful for setting the pageContext property.



I think this is similar to what you said in 2005, https://coderanch.com/t/288268/JSP/java/taglib-JSP-tagfile , any chance that faq has been written?
9 years ago
JSP

Bear Bibeault wrote:I personally would not use scriptlets. I'd create a bean that handled anything that can't be handled by the tag file body.



I'm fairly new to tags, so a tag can have a java class associated to it (<tag-class>) and can also have a tag body in the .tag file?
9 years ago
JSP
I'm trying to design a tag which queries data from a cache, restructures the data and writes a html table from data using jstl tags.

So the .tag file looks like:


The device has two kinds of data, metadata where it tells what kind of data I'll be receiving, which I'll be storing in a local database and the actual data which is received from the device whose format is as expected from the metadata. So the above cache query is a metadata cache query, not the actual data coming from the device.

Is this approach acceptable? Is it right to query the device cache using scriptlet code?
If not, what would be the best solution to these kind of problems? Is it possible to associate both a .tag file and java file to this tag so that I can separate the java logic to the java class?
9 years ago
JSP