John Harris

Greenhorn
+ Follow
since Oct 20, 2005
Merit badge: grant badges
For More
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Harris

Ben, thanks very much for the pointer. Had the <rtexprvalue> set to false. Now set it to true & everything works OK.

Regards
John
16 years ago
JSP
Hi, Within a JSP, I have defined a String variable in an expression as follows...

<% String nameKey = "CompanyNamePT" + String.valueOf(productOptions.getProdType()); %>

I've proved that this evaluates correctly but when I try & use the variable within a custom tag as follows...

<contactus:brandedText key="<%= nameKey %>" />

instead of the the nameKey expression being evaluated, the custom tag is treating the expression as a literal string.

I have seen very similar syntax within the same application that I'm working on & this works fine. Can anyone suggest why this doesn't work in this case?

Thanks
16 years ago
JSP
Hi, I'm trying to modify an existing application which curently reads in XML validation files using the following code (path being passed in is "/WEB-INF/classes/com/oneaccount/ofm/validation/rules/"):

public static void initialise(ServletContext sc, String path) {
// intitalise the HaspMap of reource names
resources = new HashMap();

// store the original path
rootPath = path;

// start the load sequence
loadNames(path, sc);
}

public static void loadNames(String path, ServletContext sc){

// record the directory name removing slashes with full stops
currentDir = getPathAsDotNotation(path, rootPath);

// load the current resources
Set resourceSet = sc.getResourcePaths(path);
Iterator iter = resourceSet.iterator();
while(iter.hasNext()){
String resourceName = (String)iter.next();
if(resourceName.substring(resourceName.length() - 1).equals("/")){
// found a directory

// remember this directory name
String dirForStepDown = currentDir;

// recursive call
loadNames(resourceName, sc);

// restore previous directory name
currentDir = dirForStepDown;
}
else{
// found a file
placeContent(resourceName);
}
}
}

The intention in the future is to JAR up the XML files (whilst preserving the existing directory structure). I've tried numerous ways of trying to access the newly created JAR file (which is in the bin directory) but not had any success so far. Can anyone suggest any solutions. Thanks in advance.
17 years ago
Eddy, thanks for the suggestion. Can you give me some more details as to where within the web.xml this needs to appear. My web.xml doesn't seem to like it anywhere?? Could it be a version issue?
Regards
John
18 years ago
JSP
Hi, I'm trying to retrieve the unicode values of currency symbols from a database (we had lots of problems with locales so this is the way it's being done).
In the database, the unicode representations eg \u20ac have been defined as Varchar2 but when they get into the Java layer, they appear as "\\u20ac". I have tried returning just the 20ac part & appending "\u" to it but JBuilder complains about illegal unicode escape characters.
Anyone know how I can arrive at the equivalent of String x = "\u20ac" ??
Thanks
18 years ago
Paul, thanks fopr the reply. I have taken on board your suggestion of simplifying the code by using the Unicode value & everything works fine if I add the <%@ page contentType="text/html; charset=UTF-8" %> directive in the JSP.

However, I would like this to apply to all JSPs and am looking for a global setting. Both the web.xml & struts-config files have the following entry <?xml version="1.0" encoding="UTF-8"?> but I presume this applies only to the coding of the files themselves?? Any advice on how I can effectively add this directive without explicitly adding it directly to each JSP page?
18 years ago
JSP
I have seen this post several times on various forums but never seen a satisfactory answer so I'm hoping someone can help. Within a JSP, I am trying to display a euro sign in a browswer by converting the ascii code for a euro as follows (the ascii code is actually coming from another method but I've hardcoded it for ease of reading) :

int currencyAsciiCode = 8364;
String formattedNumber = df.format(toFormat);
char[] asciiChar = {(char)currencyAsciiCode};
String asciiCharString = new String(asciiChar);

Within JBuilder, the code seems to work fine but by the time it hits the browser the � has become a ?. Unfortunately I can't use € in its place because the code sits in a pool of shared code & the result may not be viewed via a browser. Ihave played about with various things like getting the currency from locales but the result is the same each time.

I can only presume that there is some kind of character translation at work between the server & the browser but I have no idea where (If it's of any significance, the resultant string is being used within a Struts framework)
18 years ago
JSP