Harry Brearley

Greenhorn
+ Follow
since Feb 15, 2006
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 Harry Brearley

please note - the URL's look the same but the one that does not work uses the urlEncoding for & e.g.

please try for yourselves
12 years ago
hi, this must be simple but it is killing me....
i need to make tomcat parse the following url
http://ctkdevas1.explab.mobi:8080/ctk/test.jsp?q=hello&r=goodbye
try the link - it returns "r=null"
when i send in the following link -
http://ctkdevas1.explab.mobi:8080/ctk/test.jsp?q=hello&r=goodbye
it returns "r=goodbye"
i need to use UrlEncoding Why is this not working
The test.jsp is as below
12 years ago
Hi

Ericsson is looking for IBATIS, STRUTS, JSP experienced Java people in North Dallas. If you are interested then please send your resume to geoff.hollingworth at ericsson.com. They are looking for local people preferably.
13 years ago
thank you for pointing out my inheritance gaff
and also thank you for the pointer to the excellent faq. I strongly recommend the reading of this to anybody wanting to learn generics. It is answering my questions and confusions exceedingly well.
regards
/Harry
I do not understand the use of super in Generics.

I expect the below code to work:

class Food {}
class Fruit extends Food {}
class Apple extends Food {}

public class Pie <T super Apple> {

public static void main(String[] args) {
Pie <Fruit> p = new Pie<Fruit>();
}
}

I get a syntax error in eclipse on the super in the <T super Apple>
Fruit is a supertype of Apple.

Can someone explain the logic for super in this case?
I write the below code

package com.scjp.ch7;

import java.util.ArrayList;
import java.util.List;

public class GenericTest {

/**
* @param args
*/
public static <E extends Number> List <? super E> process (List<E> nums) {
return null;
}

public static void main(String[] args) {
// TODO Auto-generated method stub
List<Integer> input = new ArrayList<Integer>();
List<Integer> output = new ArrayList<Integer>();

output = process(input);
}
}

It gives me this error.

[root@localhost ~]# javac GenericTest.java
GenericTest.java:22: incompatible types
found : java.util.List<capture of ? super java.lang.Integer>
required: java.util.List<java.lang.Integer>
output = process(input);
^
1 error

According to my study book it should work and when i eyeball it looks correct too. Is my book wrong? (for those interested pg. 634 qu.16 of Sun Certified Programmer for Java 5.

regards
Harry
still do not understand. It compiles. it runs, it returns "b"
BUT NumberFormatException cannot be thrown by Master.doFileStuff()
?
Hi, I am studying for SJCP 1.5. I have a study book and do not understand a question/answer. Can someone please help me. Here is the question:

Given:
import java.io.*;
class Master {
String doFileStuff() throws FileNotFoundException {
return "a";
}
}

class Slave extends Master {
public static void main(String[] args) {
String s = null;
try {
s = new Slave().doFileStuff();
}
catch (Exception x) {
s = "b";
}
System.out.println(s);
}
// Insert code here
}

Does the following compile correctly and produce the output "b" when inserted at // Insert code here

String doFileStuff() throws NumberFormatException, FileNotFoundException {
return "b";
}

The answer says it works but I answered it did not since NumberFormatException is not thrown by Master so it is not a valid override.

Can someone help me understand?

thanks
Harry
i am starting to think there is not an answer for this. It seems when i hit the back button in the browser (testing with firefox) there is no communication with the web server. When i hit the forward button the same.
When i click on a link (like a hit) then it seems to fetch
?
14 years ago
I also tried putting the
<%
response.addHeader("Pragma", "NoCache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 1);
%>
at the top of the jsp page and keeping the overridden getLastModified(request) method in the servlet.

Same behaviour

I must be missing something?
14 years ago
thanks for the really fast response. I have tried this but the behaviour does not seem to have changed. Do you have this working insider an img statement. Here is mine:

<img src="${context}/sp?spId=${spId}" alt="" />

Above is from my .jsp file

/sp maps to my servlet in web.xml

Perhaps i am missing something else?
14 years ago
Hi
I need to stop caching of an image in a page. I generate a new image each time the page is viewed, by calling a servlet as the source of the <img tag.
The rest of the page is OK to be cached for longer.
Is this possible? I have tried setting the following in the servlet:
response.addHeader("Pragma", "NoCache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 1);

Seems to have zero effect. I am testing using latest firefox browser, locally on my m/c so i can guarantee no proxy caching inbetween server and client.

thank you for any help
Harry
14 years ago
Hi

I have successfully gerenated a DAO ibatos interface using Abator for Ibatis that contains a BLOB field.
I see the getter/setter methods for getting this data. My concern is that this approach seems to first read the whole BLOB into memory and then i pass it out to an outstream. The servlet is simply serving an image from the database. The files could be quite big and i could have many users in parallel. I am concerned about running out of memory.
I see in basis resultset you can use getBinaryStream on the blob and then read in and out as normal.

Can someone help me understand how to do this with Abator/Ibatis or whether in reality i will not have a problem?

thanks
/harry
Hi
I get a result set back from an sql statement to mysql with "Select count(t1.id)....."
I then pass it to make a RowSetDynaClass.
It returns a Converter error cannot convert java.lang.long to java.math.BigInteger.
It cannot find a converter from java.lang.long to java.math.BigInteger.

What am i missing? This must be a very basic use of RowSetDynaClass

regards
/Harry
Hi
i am a relative "newbie" to STRUTS but have played with J2EE, servlets, JSP, JAVA for many years, on and off. What i am starting to realise (sic: slow) is that I really need to make the best and slickest User Interfaces possible to my back end struts engine.
Please advise. What is the best technology, approach, toolsets that you recommend I start to use? I am a bit overwhelmed with choice: Tiles? JSF? Velocity, straight JSP/JSTL... to just to name a few.

Insights greatly appreciated
14 years ago
JSP