Blob + ADF BC + JSF

Hi ..
I want to show Image and insert record to table that have Blob Field on JSF page
Create table ImgTable (
Id Number primarykey,
Img Blob )
i am using ADF BC
best regards

This is my solusion for adf faces table with blob as image (maybe wrong, but working):
- create a view object with BlobDomain
- create an ADF Table from the view object
- add a new column with outputText, set its Escape property to false, set Value property to: <img src=imgservlet?imgid=#{row.Id} />
where imgservlet is a servlet returning image data and row.Id is a primary key
- imgservlet doGet looks like:
response.setContentType("image/jpeg");
String imgid = request.getParameter("imgid"); // imgid is parameter sent to servlet
OutputStream os=response.getOutputStream();
String ams="temp.model.ImgsModule"; // get application module
String cfs="ImgsModuleLocal";
ApplicationModule am=Configuration.createRootApplicationModule(ams,cfs);
ViewObject vo=am.findViewObject("Imgs"); // get view object (the same as used in the table)
Row rw=vo.getRow(new Key(new Object[]{imgid})); // get row with imgid PK (current)
BlobDomain blob = (BlobDomain)rw.getAttribute("Imgb"); // get blob
InputStream is=blob.getInputStream();
// copy blob to output
byte[] buf=new byte[BUFFER_SIZE];
int cnt;
while((cnt=is.read(buf))!=-1)
os.write(buf,0,cnt);
os.close();
Configuration.releaseRootApplicationModule(am,false);
You will see blob image instead of outputText.
Rado

Similar Messages

  • How to create a dynamic mapping of columnar at the Runtime using ADF or JSF

    How to create a dynamic GUI at the Runtime using ADF or JSF in JDeveloper 11g.
    What I am trying to build is to allow the user to map one column to another at the run time.
    Say the column A has rows 1 to 10, and column B has rows 1 to 15.
    1. Allow the user to map rows of the two tables
    2. An dhte rows of the two columns are dynamically generated at the run time.
    Any help wil be appreciated.....
    Thnaks

    Oracle supports feedback form metalink was; "What you exactly want to approach is not possible in Htmldb"
    I can guess that it is not
    exactly possible since I looked at the forums and documantation etc. but
    couldnt find anything similar than this link; "http://www.oracle.com/technology/products/database/htmldb/howtos/tabular_form.h
    t". But this is a very common need and I thought that there must be at least a workaround?
    How can I talk or write to Html Db development team about this since any ideas, this is very important item in a critial project?
    I will be able to satisfy the need in a functional way if I could make the
    select lists in the tabular form dynamic with the noz_id;
    SELECT vozellik "Özellik",
    htmldb_item.select_list_from_query(2, t2.nozellik_deger, 'select vdeger
    a,vdeger b from tozellik_deger where noz_id = 10') "Select List",
    htmldb_item.text(3, NULL, t2.vcihaz_oz_deger) "Free Text"
    FROM vcihaz_grup_ozellik t1, tcihaz_oz t2
    WHERE t1.noz_id = t2.noz_id
    AND t2.ncihaz_id = 191
    AND t1.ngrup_id = 5
    But what I exactly need i something like this dynamic query;
    SELECT
    vozellik "Özellik",
    CASE
    WHEN (t2.nozellik_deger IS NULL AND t2.vcihaz_oz_deger IS NOT NULL) THEN
    'HTMLDB_ITEM.freetext(' || rownum || ', NULL) ' || vozellik
    WHEN (t2.nozellik_deger IS NOT NULL AND t2.vcihaz_oz_deger IS NULL) THEN
    'HTMLDB_ITEM.select_list_from_query(' || rownum ||
    ', NULL, ''select vdeger a,vdeger b from tozellik_deger where noz_id = ' ||
    t1.noz_id || ''' ) ' || vozellik
    END AS "Değer"
    FROM vcihaz_grup_ozellik t1, tcihaz_oz t2
    WHERE t1.noz_id = t2.noz_id
    AND t2.ncihaz_id = 191
    AND t1.ngrup_id = 5
    Thank you very much,
    Best regards.
    H.Tonguc

  • Error While Deploying ADF BC JSF Application on Oracle WebLogic Server 10.3

    Hi All,
    I am Deploying ADF BC JSF Application on Oracle WebLogic Server 10.3
    My JDeveloper Version is - JDeveloper10.1.3.0.4
    I followed Following Links for Deployment
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11/demos/wls/wls.html
    http://blog.fekw.de/2008/08/23/howto-install-adf-10-runtime-and-deploy-adf-bc-app-to-oracle-weblogic-103-running-on-linux/
    I am Getting Following Error
    java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.<clinit>(ADFPhaseListener.java:463)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at java.lang.Class.newInstance0(Class.java:355)
         at java.lang.Class.newInstance(Class.java:308)
         at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:711)
         at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:400)
         at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:328)
    [ServerConnectionImpl.close():334] : Closing DM connection
    [ServerConnectionImpl.close():354] : Unregistered all listeners
    Thanks
    Vijay Chavan

    My bc4j.conf file is like bellow and my datasource name is expertDS
    <BC4JConfig>
    <AppModuleConfigBag>
    <AppModuleConfig name="DeptAMLocal">
    <AppModuleJndiName>model.ent.DeptAM</AppModuleJndiName>
    <DeployPlatform>LOCAL</DeployPlatform>
    <JDBCName>expert</JDBCName>
    <ApplicationName>model.ent.DeptAM</ApplicationName>
    <jbo.project>Model</jbo.project>
    </AppModuleConfig>
    <AppModuleConfig name="DeptAMEmbeddedAS">
    <jbo.internal.embedded>true</jbo.internal.embedded>
    <JDBCDataSource>jdbc/expertDS</JDBCDataSource>
    <ApplicationPath>current-workspace-app</ApplicationPath>
    <ConnectionPort>23891</ConnectionPort>
    <AppModuleJndiName>DeptAMBean</AppModuleJndiName>
    <HostName>localhost</HostName>
    <java.naming.security.authentication>simple</java.naming.security.authentication>
    <java.naming.security.credentials>
    <![CDATA[{904}05DDD90D64C79A7BC508C94B403DD81551]]>
    </java.naming.security.credentials>
    <java.naming.security.principal>oc4jadmin</java.naming.security.principal>
    <DeployPlatform>EjbIas</DeployPlatform>
    <jbo.server.internal_connection>jdbc/expertCoreDS</jbo.server.internal_connection>
    <ApplicationName>model.ent.DeptAM</ApplicationName>
    </AppModuleConfig>
    <AppModuleConfig name="DeptAMAS">
    <jbo.ampool.maxinactiveage>300000</jbo.ampool.maxinactiveage>
    <AppServerConnectionName>weblogic</AppServerConnectionName>
    <AppModuleJndiName>DeptAMBean</AppModuleJndiName>
    <DeployPlatform>EjbIas</DeployPlatform>
    <jbo.ejb.txntimeout>86400</jbo.ejb.txntimeout>
    <DtMiddleTierDeploymentProfile>../ModelMiddleTier1.deploy</DtMiddleTierDeploymentProfile>
    <jbo.security.enforce>Test</jbo.security.enforce>
    <jbo.ampool.maxpoolsize>600</jbo.ampool.maxpoolsize>
    <ApplicationName>model.ent.DeptAM</ApplicationName>
    <DtDeploymentProfile>../ModelEJB1.deploy</DtDeploymentProfile>
    <jbo.ampool.doampooling>false</jbo.ampool.doampooling>
    <java.naming.security.authentication>simple</java.naming.security.authentication>
    <DtCommonDeploymentProfile>../ModelCommon1.deploy</DtCommonDeploymentProfile>
    <JDBCDataSource>jdbc/expertDS</JDBCDataSource>
    <jbo.server.internal_connection>jdbc/expertCoreDS</jbo.server.internal_connection>
    <jbo.ampool.minavailablesize>0</jbo.ampool.minavailablesize>
    <ApplicationPath>BackBoneEJB</ApplicationPath>
    <jbo.ampool.monitorsleepinterval>10000</jbo.ampool.monitorsleepinterval>
    </AppModuleConfig>
    </AppModuleConfigBag>

  • [SOLVED]ADF BC/JSF-how to execute a "ExecuteWithParams" from a b.-bean?

    Hello everyone. I am new to ADF BC/JSF web apps. and I have a situation where I have a form that inserts a record into the DB, the page has a backing bean attached to it and the "create" button on the form is attached to a method called "grabarButton_action()" on the backing bean... here I do some validation first and then I commit the changes.... until this moment everything works fine but the thing is that after the insert takes place I need to query and get the new row I just inserted in the DB to get a value from a column that gets inserted using a trigger on the DB.
    I have been trying to do this unsuccessfully, I created a ViewObject with bind variables to try to execute the query using the "executeWithParams" action but I dont know exactly how to send the values to the action and get the results from it...
    Can anybody point me in the right direction or give me some code examples here please???!!!
    Thanks.
    Message was edited by:
    dragonov7
    Message was edited by:
    dragonov7
    Message was edited by:
    dragonov7

    DragonV,
    Why not just mark the attribute in your EO as "refresh after insert" and/or "refresh after update?" These are there to support attributes that are populated by a trigger.
    Hope this helps,
    John

  • ADF-BC/JSF How to restrict the size of an ordImage

    Hi all
    I have a table containing two columns with type ordsys.OdImage. One is a small resolution icon and the other the image itself.
    Using Steve Muench s example mo 69, I was able to create a ADF-BC/JSF application that loads images to the database.
    Now my next step is to reject images whose size in pixels is other than the one defined for thumbnails, which is 100x100, I thought that I could do this by tampering with the getter methods of the ViewRowImpl Java class but it didn't work. It appears to me that the framework creates an empty image first and then loads the contents from a file.
    Can anybody give me a clue about how to accomplish this ?
    Thanks in advance
    Thanassis

    Just finished testing the validateEntity() approach and it failed.
    I think that I must be doing something wrong here.
    I use the OrdImageDomain.getHeight() and getWidth() functions and they both return 0 wheither invoked during attribute setter method or during the validateEntity().
    Anybody out there with a clue ....
    Thanassis

  • Status of ADF BC / JSF Version of Developer Guide?

    Can anyone provide an update on when this will be available (Developer guide based on ADF BC and JSF vs. Toplink)? I'm EAGERLY awaiting - this will be very helpful.
    I was able to download the SRDemo app based on ADF BC / JSF - this is very helpful to see some real code examples. For example, I read topics related to programming View Objects and Application Modules, but viewing the actual code examples for how to call these methods was invaluable. Any other sources for ADF BC / JSF Technology scope code examples greatly appreciated.
    Thanks

    Hi,
    I think this information is what you can already get from the SRDemoBc application. I remember from an internal training i delivered that the login is performed by a ViewObject that is acting as the root VO for all application VO. In addition, to store global values, a VO is created that doesn't use queries.
    Note that I am not really a suppoter of applications that handle the login logic in itself. Its good for demos, but in praxis they should use either JAAS or J2EE authentication to fit into an overall enterprise security strategy.
    Frank

  • ORACLE ADF 11g /JSF TO  serviet (Service method) not invoking

    Hi,
    ORACLE ADF 11g /JSF TO serviet (Service method) not invoking
    My project name is : ComplProject
    inside the project im having 1 jsp say x.jsp
    work environment : (oracleADF 11g) jdev11 and weblogic server 10.3
    in x.jsp im displaying 1 go link -> when ever we click on GO link it should go to ComplServlet.java
    i tried like,
    FacesContext.getCurrentInstance().getExternalContext().redirect("/servlet/ComplServlet");
    the "ComplServlet" is an URL pattern in web.xml which points to servlet.
    but not working
    i pointed to faces-config.xml also , not working
    i tried to forward like
    FacesContext context = FacesContext.getCurrentInstance();
    ServletContext sContext = (ServletContext)context.getExternalContext().getContext();
    ServletRequest request = (ServletRequest)context.getExternalContext().getRequest();
    System.out.println("third line...............");
    HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
    response.sendRedirect("/servlet/ViewDocument");
    sContext.getRequestDispatcher("/servlet/ViewDocument").include(request, response);
    brief
    (from jsf page) after clicking on GO LINK i need to redirect or control should go to servlet ->service method
    thanks in advance
    regards,
    sandeep

    Hi,
    i tried like,
    FacesContext.getCurrentInstance().getExternalContext().redirect("/servlet/ComplServlet");
    the "ComplServlet" is an URL pattern in web.xml which points to servlet.
    but not workingUse like following.
        public HttpServletRequest getServletRequest() {
            return (HttpServletRequest)facesContext.getExternalContext().getRequest();
        public redirect(String url){
           getServletRequest().sendRedirect(getServletRequest().getContextPath() + "/servlet/ComplServlet");
        }If you are using golink as frank suggested then use it like this.
    <af:goLink text="ComplServlet" destination="/servlet/ComplServlet"/>no need of using context when using goLink,
    Regards,
    Santosh.

  • Managing blob images using ADF and JSF or struts

    Hello everyone. I am an ADF newbe and I am developing a web app. that has to manage (display, insert,update and delete) blob images from/to an oracle DB. I've seen the "howto" on image managing using intermedia and struts, but, for this new app I wanted to use JSF (something that is not mandatory) and, what is important is that the DB has already stored the images in blob format.
    Can anybody point me in the right direction please??? Is there any howtos on this subject???
    Thanks in advance.

    jfin wrote:
    but so far I have to say that I like the fact that I'll have to do very little
    System.out.println(<..../>....<>....</>).Assuming that you rather mean out.println() where out is the ServletOutputStream reference returned by HttpServletResponse#getOutputStream(), I can only agree with you. That's certainly not the way how JSP/Servlet code is to be written. The maintainability, extendability, reusability and testability would be far below the freezing point then. You need to write presentation logic in JSP files, not in Servlets and absolutely not in scriptlets inside a JSP.
    When you need to write presentation logic which may change per request, use JSTL and EL for that. Again, not scriptlets. For business and controlling logic, use Servlets. For transfer of data, use javabeans (DTO's, VO's). For data access logic, use DAO classes which are to be interacted by servlets.
    JSF removes the need for creating Servlets and using JSTL/EL in JSP files. You just have JSP pages with JSF tags for presentation and javabeans for the request values and backing beans for business logic.
    When would one use JSF over the other two? When Struts2? When Shale?And you ask that in a JSF forum? At least my opinion is predictable :)

  • Will future version of ADF support JSF 2.0

    Hi,
    I find Apache Trinidad 2.0-alpha have be released for a long time. Will Oracle introduce JSF 2.0 into ADF? Does anyone know the timeframe? Some features of JSF 2.0 such as CDI, RESTful navigation and EL 2.2 are very attractive to us.
    Thanks,

    Hi Shay,
    one of my customers is about to migrate their ADF 10.1.3.x application to ADF 11g.
    They will probably follow the trinidad path, and from there on a step by step basis convert their application to ADF Taskflows and ADF Faces Rich Client.
    You state that there will be JSF 20 support in the next major ADF release. Will there also be a supported migration path from the current JSF 12 ADF 11g release to the JSF 20 release ?
    And do you perhaps want to share your opinion (Feel free to use the disclaimer) on wether or not the customer should wait with adopting ADF Faces Rich Client untill the JSF20 support is there ?
    Thanks for your answers.
    Regards Luc Bors

  • What previous knowledge need to learn oracle jdeveloper 11g (adf faces&jsf)

    hi plz tell me, what are all technologies and languages i want to knew before i learn adf faces with jsf in oracle jdeveloper 11g

    Hi,
    Although the blog post is ok, I would certainly add a good JSF book/tutorial before the "Developing RIA Web Applications with Oracle ADF" part. For even better results, I would add a Trinidad book/tutorial before it as well. If you want to be future proof, add a Facelets tutorial between the JSF and Trinidad part. If you go right away to "Developing RIA Web Applications with Oracle ADF" you'll only make yourself a robot not understanding what happen behind the scene, often resulting in performance and memory issues as well as not so good looking application since you're going to force yourself into the Oracle LaF only.
    For the JSF part, check out http://horstmann.com/corejsf/ and, if you can handle really technical stuff: http://jcp.org/aboutJava/communityprocess/final/jsr314/index.html
    For Facelets: https://facelets.dev.java.net/nonav/docs/dev/docbook.html and http://www.ibm.com/developerworks/java/library/j-facelets/
    For Trinidad: http://myfaces.apache.org/trinidad/devguide/index.html
    Regards,
    ~ Simon

  • [ADF BC/JSF] body tag: InitialFocusID

    Hello!
    i have some questions concerning the InitialFocusID Attribute of the body tag:
    my jsf-jsp-page is pretty large so I must scroll to get to a specific faces-component.
    so what would be the behavior of InitialFocusID if i set it to this component described? (does it automatically jump to the component? - this is the behavior i need at page-load)
    hope some of you can provide me information.
    cheers, stef

    Thank you Gabrielle. At least now I have an excuse to tell my boss why I can't get it to work.
    Any idea when it may be available? Would it be a better idea to implement the table in plain vanilla JSF, and when ADF Faces is ready for ADF BC then do the migration?
    Are there any workarround to this problem?
    Thank you for your time,
    Pablo

  • ADF-BC/JSF How to display acustom error message from a backing bean

    Hi all
    Can anybody provide an example of how to manipulate the list of error messages from a JSF backing bean.
    In my code I use a different navigation case and this directs the user to the page displaying the error message but I am sure that there must be a more elegant way.
    Thanks in advance
    Thanassis

    Thanks Kris
    I think you 've put me on the right track here, it's just that in my case what I really want to do is prevent my users from editing records not belonging to their own group. This is done via a selectOne table component and then the backing bean code tests if the value #{row.UserGroup} matches the #{bindings.LoggedOnUserGroup.inputValue}. If the values are equal then the beans returns the navigation case to the edit page. Otherwise it returns the navigation case for the "cannot edit" page.
    So what I am thinking is to return null and somehow raise the right kind of exception in order to display the error in the af:messages tag.
    Thanassis

  • How to render BLOB data in jsf

    Hi ,
    I have to render an image in jsf page , which should be fetch from the data base. The data base which i am using is mysql. I got a suggestion that Servlet can be used for this purpose . But it didnt work here .The code which i try out is given below
    finHome.jsp
    <f:verbatim rendered="#{finMenuControlBean.imgCompForNonDiocese}">
    <iframe src="/ImageServlet" frameborder="0" ></iframe>
    </f:verbatim>
    ImageServlet.java
    public void doGet(HttpServletRequest request,HttpServletResponse response)..{
    ServletOutputStream out;
    response.setContentType("image/jpeg");
    response.setContentLength(user.getCurrentRole().getOrg().getImage().length);
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    out = response.getOutputStream();
    out.write(user.getCurrentRole().getOrg().getImage());
    out.flush();
    please help me
    thanks
    Ajil

    kulkarni_ash wrote:
    I have a jsf page for login, when i authenticate the next screen is a table with bunch of data,
    Where do i populate this table data and pass it along to jsp page, in struts i would define a Bean and save this bean in request and pass it to jsp page,You also need to define a bean, but you just use faces-config.xml to let JSF create and save it in request. As your question concerns the datatable, you may find this article useful to start with: [http://balusc.blogspot.com/2006/06/using-datatables.html].
    I want to be able to go to home page from any page in my application, in struts i would just define HomeAction class and then add a home button on any page, and when this button is clicked, this would call this HomeAction will be get data to be displayed on homepage and build a bean and forward request to homepage.jsp,In JSF you can use navigation cases for this. Just have something like<h:commandButton action="home" value="home" />in your JSP page and the following in the faces-config:
    <navigation-case>
        <from-outcome>home</from-outcome>
        <to-view-id>home.jsf</to-view-id>
    </navigation-case>

  • ADF-BC/JSF Attributes of reference entity objects do not appear on new rows

    Hi everyone,
    Here is something I have been meaning to ask for a long time and never found the time to do so.
    Let's suppose that we have two entities named Item and and ItemType and a view object named ItemsList defined like this
    SELECT Item.ID,
                  Item.NAME,
                  Item.TYPE
                  ItemType.NAME as TYPE_NAME
                  Item.PRICE
                  ItemType.ID AS ID1
       FROM
                  ITEMS Item, ITEM_TYPES ItemType
       WHERE
                  Item.TYPE = ItemType.IDLet's also suppose that using JDeveloper's standard ADF/SF pages, we create a list page and a create page that uses a combo box to allow the user to set the item type which then commits the changes and returns back to to the list page.
    I have noticed that new rows created using this method do not display the TYPE_NAME (and all similar) attributes, until the view is executed again. What I usually do in this case is have an Execute binding that fires only when a request scope variable is set from the creating page. This approach works for me but I feel that there must be an easier and "more right" way to achieve the same results.
    Thanassis

    Maybe you can use the getEstimatedRowCount() method on the view.
    See more info here:
    http://download.oracle.com/docs/html/B25947_01/bcquerying006.htm

  • ADF-BC JSF Counting the number of displayed rows that meet certain criteria

    Hi everyone.
    I have a JSF page that displays a table containing rows with a type attribute that may be either 'A' or 'B'. The page uses an executeWithParams form in order to set query parameters and execute the query. My users have asked me to display percentage information for type A rows at the same page.
    One way to do this would be to create an application module method that would parametrize the query, execute it, iterate through the results, do the calculation and return everything in a formatted string.. Somehow this approach does not seem right.
    Is there a best practice regarding situations like this? Any reference to code example would be perfect.
    Thanassis

    Maybe you can use the getEstimatedRowCount() method on the view.
    See more info here:
    http://download.oracle.com/docs/html/B25947_01/bcquerying006.htm

Maybe you are looking for

  • Why is my mail icon not showing unread email messages?

    For some reason, my mail icon is no longer showing my badge icon displaying the number of unread emails I have.  Within mail, next to my mailbox, it no longer shows the number of unread emails either even though there are clearly email messages with

  • Why does my HP photosmart say save and not print?

    When I go to print on my 6700 Premium printer...the dialogue box on my iMac defaults to "save" instead of "print". How do i get the dialogue box to open to "print"? This question was solved. View Solution.

  • Adding colums in S_ALR_87012357

    Hi, We have requirement to add some new colums in the report as S_ALR_87012357 in the output. I did try the BADI as FI_TAX_BADI_014, but that did not help. I need to add the m/l number in the output for the Document. Could you please help me in this

  • Need helping in writing query for finding percentage of duration

    Can any one please help in writing query for this. The table is like this :- ID     Region     Month     Duration I1 R1     Jan     80 I2     R2     Jan     70 I3     R1     Jan     70 I4     R3     Jan     40 I5     R1     Feb     80 I6     R2     F

  • Packet loss and eventual shutdown of port 80 on RV180

    I have been using my RV180 router for about a year now. I have had very little issues with it overall. I have seperate wireless access points connected and use those for my wireless devices. Recently, I started getting very odd connection problems it