Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Framework How to get the browsed file path into controller bean using JSF icefaces

Have Programming Question? Ask it here!
 
 
 


Pat Lee
How to get the browsed file path into controller bean using JSF icefaces
0 Answer(s)      2 years and 7 months ago
Posted in : Framework


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.


Advertisement
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 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 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 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... details.jspx has one datatable HOW TO solve these two datatables rendering problem.I
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
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. Code: <?php//to know your absolute path echo realpath(dirname("absolutepath.php")); ?>
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
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 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 java path name
How to write script in Java  <html> <head> <script>alert('ok')</script> </head> </Html>
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 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
JSF Manage Bean
JSF Manage Bean   how to register JSF manage bean? Please give me an example. Thanks!   JSF Manage Bean Example
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
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
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 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
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
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:-   Step1
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 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
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
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
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
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
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.    
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... the file path name. Example An example given below demonstrates that how
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
Requirements for JSF to get started
Requirements for JSF to get started  What are the requirements for JSF to get started
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 Get the Uploaded File Information in the Receiving Script?
How To Get the Uploaded File Information in the Receiving Script?  How To Get the Uploaded File Information in the Receiving Script
Java Get Class path
Java Get Class path       In this section, you will learn how to get the class path. The method System.getProperties() determines the current system properties. 
Understanding Struts Controller
Understanding Struts Controller       In this section I will describe you the Controller part of the Struts Framework. I will show you how to configure the struts
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   
Java Get File Name
Java Get File Name       In this section, you will study how to obtain the name of file.  In order to get the file name, we have provided the path of file 'Hello.txt
How to give path to the Dfile?
How to give path to the Dfile?  Hello erveryone, I want to make... on sphinx, i have to give path to the sphinx4.jar file which is present in my... not linux ,i want to try above but in this i can't get the write Dfile path , can
PHP hide file path
PHP hide file path  PHP to read a path and convert that to the virtual link
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 use spring validator with multiaction controller?
How to use spring validator with multiaction controller?  Hi, I am trying to use spring validator with multiaction controller. The configuration...="delegate"> <ref bean="configurationManagementDelegate" /> <
Accessing Jqxgrid data in Controller layer using JSP
Accessing Jqxgrid data in Controller layer using JSP  I am using... controller layer using JAVA. What i actually require is to fetch the data which... is to be inserted into the database. Atleast if I am able to get the data from Jqxgrid
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 HTTP GET request value using javascript
how to get HTTP GET request value using javascript  how to get HTTP GET request value using javascript   how is how you can get HTTP GET request value using javascript: var parameter = window.location.search.replace
Bean life cycle in spring
to retrieves the values of the bean using java file. Here in the file given below i.e....; This example gives you an idea on how to Initialize bean in the program... are retrieving the properties of the bean which we have defined in the above file
how to get the data from database&how to display the database data in jsf - Java Server Faces Questions
how to get the data from database&how to display the database data in jsf  Hi, 1.how to get the data from database. 2.how to display the database data in jsf. plese tell me the solution with example. Thanks in advance. 
 

 

 

DMCA.com