How to get the browsed file path into controller bean using JSF icefaces

How to get the browsed file path into controller bean using JSF icefaces

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,

1)...

filePathAccess.jsp

< ice:inputFile id="inputFileName" width="600" autoUpload="true" value="#{fileAccessDataBean.inputFileName}" actionListener="#{fileAccessControllerBean.browse}" />

2)...

FileAccessDataBean.java

private String inputFileName;

public String getInputFileName() {

   return inputFileName;

}

public void setInputFileName(String inputFileName) {

    this.inputFileName = inputFileName;

}

FileAccessControllerBean.java

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); 

   fileAccessDataBean.setInputFileName(inputFile.getFileInfo().getPhysicalPath()); 

   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.

View Answers









Related Tutorials/Questions & Answers:
How to get the browsed file path into controller bean using JSF icefaces
How to get the browsed file path into controller bean using JSF icefaces ... system/machine 2) Path of the file from which I browsed need to be stored... two logs I'm getting serverpath of the file.. But I want exact browsed path
How to get the full path location using <input type=file>
How to get the full path location using input type=file  Hi. I have used input type=file> in HTML to select an image. But it selects only the image but not with its full path location. how to do it? Thanks in advance
Advertisements
How to get full path of the uploaded file using commons fileupload jar file
How to get full path of the uploaded file using commons fileupload jar file  I want to upload file to database with its full path. Because of the security reasons, the browsers provide only the file name when using normal file
How to get path of a file in iOS?
How to get path of a file in iOS?  Hi iOS project I have added a file abg.jpg, Now I want to know the path of the image file when installed in iOS. Pl let's know the code. Thanks   Hi, You can use following code
How to get the output of JSP program using Bean
How to get the output of JSP program using Bean  Hi Kindly go... program for the above one by using Bean and i opened the Tomcat webserver... visit the following link: http://www.roseindia.net/jsp/using-bean-counter.shtml
How to get the output of jsp program using Bean
How to get the output of jsp program using Bean  Hello my Roseindia...; Next i created JSP program for the above one by using Bean and i opened..." %> <HTML> <HEAD> <TITLE>Use Bean Counter Example <
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
insert rows from browsed file to sql database
insert rows from browsed file to sql database  i need to insert rows... the databases using odbc i can do this. but after browsing and uploaded the file, content of the file has to go to database. how can i insert record into database
How to Store Image using JSF
How to Store Image using JSF  Hi How to upload images in db. using jsf. For jsf photo uploading .. I used this one code for upload image......... public void save(Registrationbean bean) { try { PreparedStatement
icefaces
icefaces  I am using Facelets with ICEfaces 1.8. I have a file details.jspx that is called in two different panels on the same page. What I want... details.jspx has one datatable HOW TO solve these two datatables rendering problem.I
how to get the image path when inserting the image into pdf file in jsp - JSP-Servlet
how to get the image path when inserting the image into pdf file in jsp  Hi Friend, my image path;C:/images/photo.jpg. i am getting the below error error: The type Image is ambiguous document.open(); Image
how to get the image path when inserting the image into pdf file in jsp - JSP-Servlet
how to get the image path when inserting the image into pdf file in jsp  I am using the below code but i am getting the error at .getInstance. i am using the itext.jar now.Plz help to me <% Document document=new
How to store url path in file ?
How to store url path in file ?  Hi, How to store url path in file... = robot.createScreenCapture(new Rectangle(1000,700)); String file = "C:/xampp..."; This is store phiscal directory but i want store url path like
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
icefaces
icefaces  I am using Facelets with ICEfaces 1.8. I have a file details.jspx that is called in two different panels on the same page. What I want to do is add a binding attribute to the ice ataTable in details.jspx but when I do
PHP Get Absolute Path
This example shows you how you can get the absolute path of a file. We... can get the absolute path of the file. ADS_TO_REPLACE_1 Code: <?php//to know your absolute path ADS_TO_REPLACE_2 echo realpath(dirname("
JSF Manage Bean
JSF Manage Bean   how to register JSF manage bean? Please give me an example. Thanks!   JSF Manage Bean Example
Java file absolute path
Java file absolute path In this section, you will learn how to get the absolute path of the file. Description of code: If you want to locate a file without... in the constructor of File class whose absolute path we want to know. Then call
How to get xml file form http port using web service
How to get xml file form http port using web service  hi I am suresh i am using netbeans 6.9 to develop a web service for getting xml from http port... struck with getting xml file. How to access xml file in web service? Please Help
how to get java path name
How to write script in Java  <html> <head> <script>alert('ok')</script> </head> </Html>
ICEfaces
ICEfaces       ICEfaces is a standards-compliant extension to JavaServer Faces (JSF) for building and deploying rich AJAX applications that Smooth, incremental page updates with in-place
File path for jar file
not found for the template file. Also I had tried to get that path from user...File path for jar file  Hi Experts, I have created one eclipse... path of the template, which is working as per expectation. But I have created
How to change uploaded file root path ?
How to change uploaded file root path ?  I have file upload php script. File upload working is good. But I can't find where saving that file. I think the files saving in mysql directory. How to change directory to my desired path
Creating Bean Class In JSF using NetBeans
Creating Bean Class In JSF using NetBeans  ... illustrates how to create the Bean Class. This is also called the Backing Bean... steps are used to create the bean class in the JSF application:-  ADS
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle... Oracle database and I want to know how to retrieve the path of the file... table for just the path and filename. Is there a way to do this using PL/SQL
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
Java get Absolute Path
Java get Absolute Path       In this section, you will study how to obtain the absolute path... file.getAbsolutePath() returns the absolute path of the given file.  ADS
File Path compare in java
File Path Comparison :compareTo      File Path Comparison :compareTo In this section, we will discuss how to compare pathname of two file for the equality
Java Construct File Path
Java Construct File Path In this section we will discuss about how to construct file path in Java. A file path can be constructed manually or by a Java program. It is best practice to construct a file path in Java by a Java Program
need solution to get file name from path which should give by user
need solution to get file name from path which should give by user  how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name
Problem in getting file path in js
Problem in getting file path in js  hi, I am using ofbiz framework , How i can get the file path in javascript for input type = "file" and i am using only firefox not other browser. so please help me it is very important for me
how to create bean using jsp and servlet
how to create bean using jsp and servlet  public class SampleBean { private String fname=null; private String lname=null; private int age=0; private String gender=null; private String phone=null; }   Please visit
Is JSF using JSP?
Is JSF using JSP?  Is JSF using JSP
Requirements for JSF to get started
Requirements for JSF to get started  What are the requirements for JSF to get started
PHP hide file path
PHP hide file path  PHP to read a path and convert that to the virtual link
Java example to get the execution path
Java example to get the execution path       get execution path We can get the execution path of the system in java by using the system property. For getting execution
How to upload file using JSP?
How to upload file using JSP?   Hi all, I m the beginner in JSP, I want to upload file on server in specific folder.   1)page.jsp... file upload form to the user</TITLE></HEAD> <
CMS project using JSF
CMS project using JSF  Can i use jsf for CMS project..? If yes pls give some guidelines to how to start
Getting path name of uploading file in struts 2.8.1
Getting path name of uploading file in struts 2.8.1  Hai! I am using struts 2.8.1. I want to upload file into database with the path name. How can I can get the original path name of the file in struts 2.8.1? It only display
How to zip a file using javascrip?
How to zip a file using javascrip?  hi.. can anyone tell me How to zip a file using javascrip
How to write to file using FileOutputStream
How to write to file using FileOutputStream  Hi friends, Please help me in java program. How to write to file using FileOutputStream? thanks,   Hi, To write a file using FileOutputStream, we have to use
How to write to file using FileWriter
How to write to file using FileWriter  hi, How to write to file using FileWriter thanks,   Hi, To writing in a file in Java program we... of the FileWriter class can be created using the following of its constructor i.e. FileWriter
insert date into database using jsf
insert date into database using jsf  Hello I need a simple example of source code to insert a date into a database using jsf what do I have to put in backing bean and page jsf ( i need juste a date ) thanks
ModuleNotFoundError: No module named 'file-path'
'file-path' How to remove the ModuleNotFoundError: No module named 'file...ModuleNotFoundError: No module named 'file-path'  Hi, My Python... have to install padas library. You can install file-path python with following
how to get description for each file
how to get description for each file  hi, how to get description for each file using php or java script..... condtion:two text boxes for each file if the user select 10 file to upload........get the description
Constructing a File Name path
construct a file name path. By using the constructing filename path it is possible to set dynamic path, which is helpful for mapping local  file name... Constructing a File Name path   
receiving null value in back bean by the jsf page
receiving null value in back bean by the jsf page  i have done above things but i m receiving null value in back bean by the jsf page plz tell me solution as soon as possible
how to get file extension in java
how to get file extension in java  Hi, I want to get the file extension in Java. how to get file extension in java? Thanks   Hi, Here is sample code to get file extension in Java: package examples; import

Ads