Table of Contents


The <mobi:camera> component allows the developer to take a picture using a device's camera, and then upload the picture to the server to be processed or stored. For a non-container browser, the component will render a file upload button as a fallback, which will allow the user to select a picture on their local file system, which can then be uploaded in a similar manner. This component can be used with the <mobi:uploadhelper> component as seen in the example below with the <mobi:thumbnail>.


An ICEmobile Device Container must be present in order to use this component for taking an actual picture.

Basic use with no user parameters

You will typically want to use the upload button to upload the image taken by the camera to the server.  There is a valueChangeListener attribute which returns the value of the component map via the newValue attribute of the event.

<h:form enctype="multipart/form-data">
   <mobi:camera id="camera" value="#{cameraBean.cameraImage}"
   <mobi:commandButton type="button" value="Upload"/>

The Map object is value bound to a backing bean and the File and contentType can be extracted from the Map in the backing bean.

public void setCameraImage(Map imageMap){
    this.cameraImage = imageMap;
    File imageFile = (File)imageMap.get("file");
    String contentType = (String)imageMap.get("contentType");
    //you can use these objects to view the file with mobi:graphicImage

Any validation that is required on this component can be done via the valueChangeListener as follows:

  public void methodOne(ValueChangeEvent event){
        // use this method to check filetype and can possibly remove the file if not correct filetype
         if (event!=null){
            Map compMap = (HashMap)event.getNewValue();
            File fname = (File)compMap.get(CAMERA_KEY_FILE);
            //can check for valid fileType and throw FacesMessage, convert file to other type, etc.....

Use with <mobi:thumbnail>

   <mobi:camera id="camera"
   <mobi:thumbnail for="camera"/>
   <h:commandButton type="button"

Component Documentation


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 03, 2011

    Anonymous says:

    Thanks for the great info dog I owe you biggtiy.

    Thanks for the great info dog I owe you biggtiy.

  2. Sep 04, 2011

    Anonymous says:

    4rLSs6 <a href="">gqnpoavtbtxb</a>

    4rLSs6 <a href="">gqnpoavtbtxb</a>

  3. Sep 04, 2011

    Anonymous says:

    RRbreV , [url=]rebvkqgmxssw[/url], [...

    RRbreV , [url=]rebvkqgmxssw[/url], [link=]imzakirszcxq[/link],

© Copyright 2016 ICEsoft Technologies Canada Corp.