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

Joseph Siao

Ranch Hand
+ Follow
since Feb 26, 2004
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 Joseph Siao

Hi. I am using JXL to read an Excel file using Java.

One of the columns on the file is in a Time Format.

What is displayed in the Excel cell is (24-hr format): 0:01

When I highlight the cell, the value is different in the formula bar. It reads 12:01:00 AM

Using the code:
sheet.getCell(7,i).getContents()

returns a value of 12:01

My problem is, using the value extracted, there is no way for me know if 12:01 is AM or PM.

How can I extract the value from excel getting the displayed value? the 0:01.

or, how can I extract the value, that I can get the AM/PM?

Please advice. thank you.

Hi Ulf Dittmer,

The getContents is not in the initial code I gave. I just played around to check what seems to be the problem.

Here is the stacktrace thrown by the Exception (below). The first 3 lines are success. Just to give you an idea. The number are the row numbers in excel. Then after the dash, is the color description of the cell.

After row 28, it gave me the null pointer exception. The supposedly 29 row is a blank row. Then it continued to the next.

26 - default background
27 - default background
28 - grey 25%
java.lang.NullPointerException
at wb.util.UtilData.readColor(UtilData.java:223)
at wb.eecompare.EECheck.main(EECheck.java:44)
30 - default background
31 - default background
32 - default background

I have attached an image of the excel data to better explain. Please advice.
11 years ago
Hi Ulf Dittmer, thank you for the reply.

I tried adding this code:

System.out.println(sheet.getCell(0, i).getContents());

it gave me a blank output. I also tried to put in an if statement to check if the code below returns a null. But it doesn't return null..
sheet.getCell(0, i).getCellFormat().getBackgroundColour().getDescription()

I am at a lost how to get around this..
11 years ago
Hello everyone. I am currently using JXL to read Excel files. And came to a problem.

I have this excel files that have rows with data, rows with spaces, rows with colors, rows with colors and data, etc. Here is my code:

public void readColor() throws Exception{
Workbook workbook = Workbook.getWorkbook(
new File("c:\\myexcel.xls"));
Sheet sheet = workbook.getSheet(2);
for(int i=3; i<sheet.getRows(); i++){
System.out.println(i + 1 + " - " +sheet.getCell(0, i).getCellFormat().getBackgroundColour().getDescription());
}
workbook.close();

}

when I run this, somewhere in the middle, it produced a java.lang.NullPointerException.

I tried to investigate, the error stopped a row blank row. I was wondering because it did not generate an error for the previous blank rows. I went to my excel file, and, i highlighted the sell, and set the background color to "no fill" (current is already no color/no fill). After that, code went thru...

Is there a way for me to code this that it will detect the right color of the cell, without throwing this exceptions? I think the exception is really weird..>
11 years ago
Thanks Bauke. I'll give it a try.
15 years ago
JSF
Hi Lynette. I tried the website you gave me.

I used attribute on my commandButton to pass values. I have a new error, attribute does not support runtime expressions.

Here is how I did it:

h:attribute param="response" value="<%=resp;%>"

any way around this?
15 years ago
JSF
Thanks Lynette. This will help greatly.
15 years ago
JSF
Thanks Lynette.

I can do that. but the values are coming from the jsp page. or is there a way to pass a parameter through the action? something like this:

h:commandButton action="#{myBean.method(parameter)}"
15 years ago
JSF
Thanks again.

value1, value2, and value3 will be coming from a modal dialog. Its values are yes, no and cancel.

depending on the value, different methods are called from a single button. is this possible? or is there a different approach?
15 years ago
JSF
Thank you for the answer.

But I need to set the action dynamically. I will be having 4 conditions, and each condition will call a different method on my backing bean.

Something like this:

function confirmAction(obj){
if(value1){
obj.action = "#{backing.method1}";
return true;
}else if(value2){
obj.action = "#{backing.method2}";
return true;
}else if(value3){
obj.action = "#{backing.method3}";
}else {
return false;
}
}

suggestions please.
15 years ago
JSF
I have a commandbutton declared as:

<af:commandButton text="#{res[\'button.delete\']}"
id="cmdDelete"
action=""
on_click="return confirmAction(this)"/>

Then I have a javascript for the confirmAction:

function confirmAction(obj){
obj.action = "#{backingTest.testMethod}";
return true;
}

This doesn't seem to set the action. Am I doing it wrong?
15 years ago
JSF
I can't seem to find what kind of solution that is causing this error.

Scenario. I created simple EJB, a session, container-managed, stateless, and local. I added a simple method in my bean, that only has a System.out.println message, promoted the method to local interface. I created a test server, the i clicked on my ejb, then choose "run on server".

I have this error coming out of the console :

[12/8/04 12:07:35:984 CST] 3ac9afad TraceNLS u No message text associated with key HttpConnection.run:.java.lang.IllegalStateException:.0.response.bytes.written,.but.Content-Length.header.equals.7710 in bundle com.ibm.ejs.resources.seriousMessages
[12/8/04 12:07:35:969 CST] 3ac9afad HttpConnectio E HttpConnection.run: java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 7710
[12/8/04 12:07:36:031 CST] 3ac9afad SystemOut O java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 7710
[12/8/04 12:07:36:031 CST] 3ac9afad SystemOut O at com.ibm.ws.http.HttpResponse.finish(HttpResponse.java:99)
[12/8/04 12:07:36:031 CST] 3ac9afad SystemOut O at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:681)
[12/8/04 12:07:36:031 CST] 3ac9afad SystemOut O at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
[12/8/04 12:07:36:031 CST] 3ac9afad SystemOut O at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[12/8/04 12:07:36:062 CST] 5005afaa TraceNLS u No message text associated with key HttpConnection.run:.java.lang.IllegalStateException:.0.response.bytes.written,.but.Content-Length.header.equals.689 in bundle com.ibm.ejs.resources.seriousMessages
[12/8/04 12:07:36:062 CST] 5005afaa HttpConnectio E HttpConnection.run: java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 689
[12/8/04 12:07:36:078 CST] 5005afaa SystemOut O java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 689
[12/8/04 12:07:36:078 CST] 5005afaa SystemOut O at com.ibm.ws.http.HttpResponse.finish(HttpResponse.java:99)
[12/8/04 12:07:36:094 CST] 5005afaa SystemOut O at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:681)
[12/8/04 12:07:36:156 CST] 5005afaa SystemOut O at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
[12/8/04 12:07:36:156 CST] 5005afaa SystemOut O at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[12/8/04 12:07:38:297 CST] 12f02fae WebGroup I SRVE0180I: [IBM Universal Test Client] [/UTC] [Servlet.LOG]: treeExpansionServlet: init

anyone knows how i can fix this? Thanks.
17 years ago
I don't know if this is the right forum or this should be in the websphere forum. but ill just fire away the question.

Anybody here knows how to integrate cactus 1.6.1 to wsad 5.1? or a link that has a step by step tutorial how.

Thanks.
17 years ago
Thanks a lot. it worked
17 years ago