Setting the size of a JSF image

You can change the size of a JavaServer Faces (JSF) image on a Faces JSP page with EGL code. You must use a Faces image control; an EGL JSF Handler cannot directly change ordinary HTML image tags.

This task has the following prerequisites: For more information on these prerequisites, see Accessing the JSF component tree with the source assistant.
Follow these steps to change the size of a JSF image control with an EGL JSF Handler:
  1. On a blank line inside a function in the JSF Handler, press Ctrl+Shift+Z. The EGL Source Assistant window opens, displaying the JSF controls on the page.
  2. In the EGL Source Assistant window, select the JSF image control that you want to access.
  3. Click OK.
    The EGL source assistant adds two lines of EGL code to the JSF Handler. The first line defines an EGL variable of the type that matches the JSF control that you selected. The second line associates that variable with the JSF control. For example, the code to access a JSF image control might look like this:
    imageEx1 HtmlGraphicImageEx;
    imageEx1 = myViewRoot.findComponent("imageEx1");
  4. Using the EGL variable that the source assistant created, change the size of the JSF image control with the setHeight and setWidth functions, passing each function a string or literal that specifies the measurement in pixels. For example, to make the image 300 pixels wide and 200 pixels tall, add this code:
    imageEx1.setWidth("300");
    imageEx1.setHeight("300");

Feedback