Jeff Weeks

Greenhorn
+ Follow
since Nov 17, 2003
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 Jeff Weeks

Ahh, right you are!
Definitly was a problem with my model, and a misconception in how I build it from a recursive structure! Argh!
Ironically enough, the only two fields effected by this bug were the two that had drop-down editors... and both of their data was written correctly to the database, so I was totally confused Everything worked... but it didn't... if you know what I mean
Anyway, thanks!
Jeff
16 years ago
Hey everybody,
I've got a JTable that is editable, and one of the fields is a promo code (which is essentially just a letter from A-Z). Because of the finite number of codes, I've used a JComboBox as a custom cell editor and applied it to that cell:

I can select a promo code just fine from the dropdown, and it will then display as that cell's contents. However, when I load in table data that already has a promo code set, it displays as nothing.
I can confirm that the value is properly set in the table model, it just seems that by adding this custom cell editor, the data in the cell is cleared.
Any ideas why? And is there a way to force this data to be displayed?
Thanks,
Jeff
16 years ago
Hello,
I'm using a JTable to display a list of mostly String values.
There is one Double, however, that is not being displayed properly. For example:
0.0099 displays as 0.01
0.0166 displays as 0.017
It seems that the JTable is rounding to the nearest thousandth decimal place, but I require full accuracy for this table. Is there a way to force full accuracy when outputing Double values?
If I add the value as a String to the table model, the value is properly displayed, but is no longer a number, nor is it properly right aligned, of course.
Any suggestions?
BTW: I store a copy of the beans used in creating each table row, and can confirm that the original double values are unchanged (and still reflect 0.0099, and 0.0166, for example)
16 years ago
This is really confusing me folks... I don't understand...
I'm using the jwsdp to call a remote web service, and have been doing so with relative success until this point.
The code I'm having trouble on is as follows:

Pretty simple the getSTDClientStub() looks like this:

Again, pretty simple However, I get a method not found error!

"STDService.java": Error #: 300 : method putFormula(com.kellogg.london.common.beans.standards.FormulaMapBean) not found in class com.kellogg.london.services.standards.StandardsJWSIF_Stub at line 64, column 19
Which is incredibly odd, because both my IF file defines the method as:
int putFormula(FormulaMapBean bean) throws RemoteException;
And the IMPL implements it as such!
So, why on earth would it claim it can't find the method? The method even appears in JBuilder's list of available methods, but upon building, it simply wont compile!
Other methods in this class execute properly.
The only major different between this method, and the others (that work) is that this one accepts a custom class. However, I've added it to the config-interface.xml file, and rebuilt the service... still nothing wants to work!
Any ideas?
Thanks,
Jeff
16 years ago
Cheers! All working now
I thought I'd already done that
I was loaded my applet from the /webcontext/classes directory which I had simply assumed was the standards.war:/web-inf/classes directory, and that all the classes were in there. Obviously that wasn't the case
Thanks,
Jeff
16 years ago
Hello,
I have a rather annoying issue communicating between an Applet and a servlet. The basic flow of information is as follows:
The applet constructs a HashMap of criteria information for a query (name/value pairs, like "productCode" => "1001233"). This HashMap is transfered to the servlet through a POST request. This part works fine.
The servlet receives this criteria, and performs a query, and attempts to return back a custom object (named FormulaMapBean (which also contains references to ComponentBean and FormulaBean)). This part fails. I've ran with tracing of 5, and found the following in the Java console:
Reading bean
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/FormulaMapBean.class with no proxy
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/FormulaMapBean.class with cookie "JSESSIONID=D85890B193E5A4A8F0F0D0662226A577"
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/FormulaBean.class with no proxy
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/FormulaBean.class with cookie "JSESSIONID=D85890B193E5A4A8F0F0D0662226A577"
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/ComponentBean.class with no proxy
Connecting http://localhost:8082/standards/classes/com/kellogg/london/common/beans/standards/ComponentBean.class with cookie "JSESSIONID=D85890B193E5A4A8F0F0D0662226A577"
Finding information ...
Releasing classloader: sun.plugin.ClassLoaderInfo@82751, refcount=0
Done ...
java.lang.ClassNotFoundException: com.kellogg.london.common.beans.standards.FormulaMapBean
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.io.ObjectInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.kellogg.london.applets.standards.AppletServletCommunicator.readBean(AppletServletCommunicator.java:179)
at com.kellogg.london.applets.standards.FormulaQueryApplet.init(FormulaQueryApplet.java:47)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 17 more

What I find really strange, however, is that this works perfectly fine when using a Java class (I've tried changing the HashMap, and returning it, and that works perfectly fine, however, returning these custom objects doesn't).
Any ideas?
These objects are serializable. They're initially loaded (by the servlet) from a web service, and this works fine as well! It's the transition from Servlet to Applet that keeps screwing up, and I dont understand why.
General flow (in Applet):
comm.startPost("application/octet-stream");
comm.sendBean(params);
comm.endPost();
System.out.println("Reading bean");
Object o = comm.readBean(); // fails if o is a FormulaMapBean
General flow (in servlet):
comm.setInputStream(request.getInputStream());
Object o = comm.readBean(); // criteria hashmap (works!)
FormulaMapBean fmb = getFormula(map);
comm.setOutputStream(response.getOutputStream());
comm.sendBean(fmb);
where comm is a class I wrote with the following relevant methods:
public void startPost(String type) {
try {
URL testServlet = new URL( servletAddress );
servletConnection = testServlet.openConnection();
// make sure we can both read and write to servlet
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
// Don't use a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);
// Specify the content type that we will send binary data
servletConnection.setRequestProperty("Content-Type", type);
servletOutputStream = servletConnection.getOutputStream();
// send your data to the servlet
} catch(Exception e) {
e.printStackTrace();
}
}
public void endPost() {
try {
servletInputStream = servletConnection.getInputStream();
} catch(Exception e) {
e.printStackTrace();
}
}
public void sendBean(Object o) {
try {
ObjectOutputStream outputToServlet = new ObjectOutputStream(servletOutputStream);
outputToServlet.writeObject(o);
outputToServlet.flush();
outputToServlet.close();
} catch(Exception e) {
e.printStackTrace();
}
}
public Object readBean() {
Object o = null;
try {
ObjectInputStream inputFromServlet = new ObjectInputStream(servletInputStream);
o = inputFromServlet.readObject();
inputFromServlet.close();
} catch(Exception e) {
e.printStackTrace();
}
return o;
}

Any help would be greatly appreciated (and I appologize for the long post... this stuff's fairly new to me, so I'm not sure all what's relevant). It looks like it's a case of having to somehow 'Register' with the ObjectInputSteam where the FormulaMapBean.class is located... except that, from the Java Console output (first few lines) it seems to me that is does, indeed, know where it is!
Cheers,
Jeff
16 years ago