lee chan

+ Follow
since Jun 14, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by lee chan


I'm very new to webservices. Please give steps for top down aproach to create JAX-WS webservice and how to consume the implemented one.
4 years ago
Thanks to all.

I started work as you guys suggested. My work is going smoothly.
5 years ago
Hi Tookey ,

Thanks for your reply. While a file is saving, we can select an option called encode. Please find attached snapshots.

So, How can I get the encoding formats of those two files in java.
5 years ago
Hi All,

I've set of .txt files which are having different different encoding version. For example,

1) a.txt ---> Encoding version is ANSI
2) b.txt ---> Encoding version is UNICODE
3) c.txt ---> Encoding version is UTF-8


how can I read these files in a single class?

that is,

If the file path I entered in the console is related to a.txt...
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream));

If the file path I entered in the console is related to b.txt...
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream, "UNICODE"));

If the file path I entered in the console is related to c.txt...
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream, "UTF-8"));

How can I know the the entered any .txt file encoding version?

So that, instead of hardcoding theUNICODE/UTF-8/ANSI, I can get the version in a variable and can use the variable as second parameter to InputStreamReader.

Please help me out.
5 years ago
Use the below code... you will get the line by line data

String a[] = s.toString().split("\n");
5 years ago

The below is the code... and at last s is holding the content line by line.

public class test {
public static void main(String[] args) {

StringBuffer s = new StringBuffer();

for(int i=0;i<2;i++) {
s = s.append("abc" + "\n");


s value:

My question is how can i read s value line by line? Please help me in this regard ASAP.
5 years ago
Hi All,

I've a requirement as,

1) Need to browse a file from my local system/machine
2) Path of the file from which I browsed need to be stored in a variable in controllerbean.

This thing I've done as below,

<ice:inputFile id="inputFileName" width="600" autoUpload="true" value="#{fileAccessDataBean.inputFileName}"

/** variable to hold inputFileName. */
private String inputFileName;

* @return the inputFileName
public String getInputFileName() {
return inputFileName;

* @param inputFileName the inputFileName to set
public void setInputFileName(String inputFileName) {
this.inputFileName = inputFileName;

public class FileAccessControllerBean {

/** latest file uploaded by client. */
private FileInfo currentFile;

FileAccessDataBean fileAccessDataBean = new FileAccessDataBean();

* This method is for gettingsetting browse.
* @param event ActionEvent
public void browse(ActionEvent event) {
InputFile inputFile = (InputFile) event.getSource();
String filePath = null;

LOG.debug("XXX Getting File Info into currentFile..." + inputFile);

currentFile = inputFile.getFileInfo();

LOG.info("XXX current File Name... " + currentFile.getFileName());
filePath = inputFile.getFileInfo().getPhysicalPath();
LOG.info("XXX physical path... " + filePath);


File file = currentFile.getFile();
filePath = file.getAbsolutePath();
LOG.info("XXX absolute path.. " + filePath);


Browsed file location: C:\Documents and Settings\personInfo.xml

XXX Getting File Info into currentFile... personInfo.xml
XXX current File Name... personInfo.xml
XXX physical path File Name... U:\glassfish.frontend\domains\..\..\personInfo.xml
XXX absolute path.. U:\glassfish.frontend\domains\..\..\personInfo.xml

in the above two logs I'm getting serverpath of the file.. But I want exact browsed path that is C:\Documents and Settings\personInfo.xml

how can I get the path? Is there any other way to browse the file and get the path of the file into controllerbean?

PLEASE HELP ME OUT It's very urgent requirement for me.
6 years ago

I browsed a file using <ice:inputFile .../> .
Now my requirement is to show the browsed file when I click on "view" button.

How to do this using icefaces and what will be the actionlistener code in controllerbean?
Please help me out ASAP
6 years ago
Thank you.

Is there any other way to browse a file and persist the path in the input text-box using icefaces.
6 years ago
i used <ice:inputFile..... >

When i click on upload button, path of the file which i browsed been not showing in the input textbox.

How can i persist this path in the input textbox.

I need this requirement urgently. please help me out.
6 years ago

I have a button named "Select" when I click on it, should browse a file in from my local system.

I need to use icefaces. I used like <ice:inputFile id="select" width="600" value="#{abcDataBean.select}" />.

But its giving the output with an inbuilt textbox + browse button.

But, I want functionality of browse button when I click on "Select" button. I don't want browse button to be shown on the screen.

Please help me out as soon as possible.
6 years ago

Matthew Brown wrote:What's going on there is "variable hiding".

In method b(), you've got access to two separate variables a:
- one that's declared as a static member of the class
- one that's declared as an argument in of the method

The second takes precendence, so the variable that's been changed is not the one that you can access from method c()

How you'd fix it? Avoid using the same variable name for different variables. Or explicitly refer to Test.a if that's what you want.

Thank you.

After changing the code in method b() from
a = 12; to Test.a = 12;
am able to print the value of a as in method b() into method c();
6 years ago
Hi below is my class...

a... in b....12
a... in c....0

Please help me out how to get the same value of a which is in method b into method c
6 years ago

William Brogden wrote:This free online book by Harold is loaded with useful examples including some similar to your problem.


Thank you William...

I'm very new to parsing...Please help me out in this concern...

I've an xml called example.xml


Now by using XPATH or DOM or SAX I want to get elements <A1>, <A2> and the corresponding <Sub> values...
let me know how to do.