Generate PDF using Managed Bean with custom HTTP headers

Background
Generate a report in various formats (e.g., PDF, delimited, Excel, HTML, etc.) using JDeveloper 11g Release 2 (11.1.2.3.0) upon clicking an af:commandButton. See also the StackOverflow version of this question:
http://stackoverflow.com/q/13654625/59087
Problem
HTTP headers are being sent twice: once by the framework and once by a bean.
Source Code
The source code includes:
- Button Action
- Managed Bean
- Task Flow
Button Action
The button action:
<af:commandButton text="Report" id="submitReport" action="Execute" />
Managed Bean
The Managed Bean is fairly complex. The code to `responseComplete` is getting called, however it does not seem to be called sufficiently early to prevent the application framework from writing the HTTP headers.
HTTP Response Header Override
* Sets the HTTP headers required to indicate to the browser that the
* report is to be downloaded (rather than displayed in the current
* window).
protected void setDownloadHeaders() {
HttpServletResponse response = getServletResponse();
response.setHeader( "Content-Description", getContentDescription() );
response.setHeader( "Content-Disposition", "attachment, filename="
+ getFilename() );
response.setHeader( "Content-Type", getContentType() );
response.setHeader( "Content-Transfer-Encoding",
getContentTransferEncoding() );
Issue Response Complete
The bean indirectly tells the framework that the response is handled (by the bean):
getFacesContext().responseComplete();
Bean Run and Configure
public void run() {
try {
Report report = getReport();
configure(report.getParameters());
report.run();
} catch (Exception e) {
e.printStackTrace();
private void configure(Parameters p) {
p.put(ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
p.put(ReportImpl.SYSTEM_REPORT_HOST, "localhost");
p.put(ReportImpl.SYSTEM_REPORT_PORT, "7002");
p.put(ReportImpl.SYSTEM_REPORT_PATH, "/reports/rwservlet");
p.put(Parameters.PARAM_REPORT_FORMAT, "pdf");
p.put("report_cmdkey", getReportName());
p.put("report_ORACLE_1", getReportDestinationType());
p.put("report_ORACLE_2", getReportDestinationFormat());
Task Flow
The Task Flow calls Execute, which refers to the bean's `run()` method:
entry -> main -> Execute -> ReportBeanRun
Where:
<method-call id="ReportBeanRun">
<description>Executes a report</description>
<display-name>Execute Report</display-name>
<method>#{reportBean.run}</method>
<outcome>
<fixed-outcome>success</fixed-outcome>
</outcome>
</method-call>
The bean is assigned to the `request` scope, with a few managed properties:
<control-flow-rule id="__3">
<from-activity-id>main</from-activity-id>
<control-flow-case id="ExecuteReport">
<from-outcome>Execute</from-outcome>
<to-activity-id>ReportBeanRun</to-activity-id>
</control-flow-case>
</control-flow-rule>
<managed-bean id="ReportBean">
<description>Executes a report</description>
<display-name>ReportBean</display-name>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
The `<fixed-outcome>success</fixed-outcome>` strikes me as incorrect -- I don't want the method call to return to another task.
Restrictions
The report server receives requests from the web server exclusively. The report server URL cannot be used by browsers to download directly, for security reasons.
Error Messages
The error message that is generated:
Duplicate headers received from server
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.Nevertheless, the report is being generated. Preventing the framework from writing the HTTP headers would resolve this issue.
Question
How can you set the HTTP headers in ADF while using a Task Flow to generate a PDF by calling a managed bean?
Ideas
Some additional ideas:
- Override the Page Lifecycle Phase Listener (`ADFPhaseListener` + `PageLifecycle`)
- Develop a custom Servlet on the web server
Related Links
- http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
- http://www.slideshare.net/lucbors/reports-no-notes#btnNext
- http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
- http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
Thank you!

The problem was that the HTTP headers were in fact being written twice:
1. The report server was returning HTTP response headers.
2. The bean was including its own HTTP response headers (as shown in the question).
3. The bean was copying the entire contents of the report server response, including the headers, into the output stream.
Firefox ignored the duplicate header errors, but Google Chrome did not.

Similar Messages

  • Generating PDF from Microsoft Word with C#

    Hello,
    We have created web-based system for a customer that stores/handles Microsoft word documents and provides these to users as PDF versions. Unfortunately some problems appear with our third-party component that generates PDF from Word. Our customer has previously used Adobe Acrobat X Pro to manually generate the PDF files and is confident that the output produced this way is valid. Despite searching and reading a lot I can't find any way to determine if (and how) it is possible to automate the process of generating a PDF file from a Microsoft word file using the Adobe engine. There is a lot of SDK documentation, how to control PDF rendering in winforms applications etc. etc. All I want to do is to load an Adobe Acrobat instance, feed it with a word document and save it as a PDF on disk. From a C# app (ASP.NET). Is that possible?
    Best regards
    Jan Hansen

    As mentioned, you can probably send the DOC file to the Adobe PDF printer to create the file. What I keep reading in your post is a legal issue. You keep mentioning being able to create the PDF on a server automatically. The server use of Acrobat is a violation of the EULA. If you are creting the files off-line for posting as has been done, there should not be a problem. However, having these created in an automated manner by the user may be an issue. Before you go much further, I would check with legal counsel about the use of Acrobat in the way you intend. If they indicate there is a problem, then your question is not needed.
    Back to the issue. Try just dropping a DOC file on the Adobe PDF printer icon (you may have to open the Start>Printers to do that. See if that creates the PDF. If so, you will just need to automate that process.

  • Share stateful session bean in JSF managed beans with different scope

    Hi,
    I have a JSF application and I want to try to use of stateful session beans.
    So I created a new stateful session bean and its local interface.
    @Stateful
    public class StatefulSessionBean implements StatefulSessionBeanLocalInterface{
    private String name;
    @Local
    public interface StatefulSessionBeanLocalInterface {
    ...In my JSF application I have a mananed bean with session context which registers the new interface by
    this annotation
    @EJB(name="sessionbeanref", beanInterface=StatefulSessionBeanLocalInterface.class) and set the name to something.
    Now I want to fetch this name in another managed bean with request scope. So I looked up the bean and tried to get the name.
    StatefulSessionBeanLocalInterface = (StatefulSessionBeanLocalInterface) new InitialContext().lookup("java:comp/env/sessionbeanref");
    System.out.println(currentmailingbean.getName());but the name is null.
    Why?

    The xsd was created via the netbeans J2EE enterprise application dialog and I think its the most recent.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">All other annotations seem to work.
    Wouldnt the lookup completely fail if the deployment process thought that it is version 1.4 ?

  • Using java bean with jsp

    hello friends,
    i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
    i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
    also when i use an additional field other than username the jsp page is showing error.
    Please give me the correct method to use java bean with jsp in this circumstance.
    thank you.

    thank you, but i have a problem left. the case is like this.
    i got the jsp and bean worked fine when i have a sinle input text field.
    but when i added a second text field i recieved the following error.
    javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
    pls hlp.

  • Problem while generating PDF using iText

    Hi:
    I have generated PDF using iText, where i have written all code in sequential flow.
    <code>
    com.lowagie.text.Document document = new com.lowagie.text.Document(PageSize.A4, 55, 5, 20, 20);
    OutputStream outputstream = response.getOutputStream();
    PdfWriter.getInstance(document,outputstream);
    </code>
    And i have added all fields in the document.
    But my problem is how to display total pagecount on all pages e.g.1\20 (because i have generated PDF sequentially)
    Also i want to add watermark on all pages.
    So, can any body help me to solve this problem?
    Thank You,
    Balaji

    sabre150 wrote:
    Maybe http://itext-general.2136553.n4.nabble.com/
    Nice pron link in there :/

  • To generate PDF using BI APIs and loadjava utility

    Hi All,
    I am trying to generate PDF using BI APIs(FOProcessor etc).
    I have generated XML data through the PL/SQl procedure and storing it in a file. This file is loacted in database tier.
    The APIs is used through a simple java program which is application tier. To test the process, I had to manually provide the XML file to the java class in order to generate PDF and it does generate.
    Now the issue is I need to load the java class to the database so that everything gets automated(loadjava utlility).
    when i try to do it, it give no class found error.
    Do I need to load the referenced classes in the java file , that is, FOProcessor,RTFProcessor,FOUtility,jdbc.driver.OracleDriver as well?
    If the above is not possible, is it possible to reference a file in database tier from application tier so that i can use the XML file as input the java class in application tier.
    thanks,
    Srik

    The only reason I am responding to this post is because the poster sent me a request through the forum message system asking for my help.
    Although I did populate PDFs with FDF data generated by web forms a year or so ago, I have since abandoned that kind of solution. It was a big headache. I found it far more stable and flexible to use html, php and css to populate forms that are almost as nice looking as PDFs.
    So my advice is, if you can possibly avoid going the FDF/PDF route, you will be better off.

  • Using Managed bean

    Hi All,
    How to use managed bean instead of backing bean to retreive a value from a object.
    a)Say in my form i have selectoneChoice box and i need to retreive the value inputed by the user
    b)According to the value selected by the user i need to show a tick mark or cross mark. Is it possible.
    Am using ADF 11g
    Please guide me how to acheive this.
    Thanks in Advance

    Your backing bean can access the bindings object and get the value of the attribute from there in your code.
    Lots of code samples for this here:
    http://biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-adf.html
    For list binding there is a little trick though:
    http://www.oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html
    I would also suggest that you watch the seminars about binding in the ADF Insider series:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html

  • Can I use BI Beans with Jbuilder?

    hi
    Can I use BI Beans with Jbuilder Instead of JDeveloper.

    Is there a separate download for this (a version that will work with any J2EE IDE, I'm using JBuilder X)? When I tried to install the BI Beans download, it failed because it was looking for a version of JDeveloper.
    Yes, BI Beans are J2EE compliant components and will
    work within any J2EE compliant IDE. However, as
    JBuilder does not support the JDeveloper wizard
    driven development paradigm you will experience the
    same level of productivity using JBuilder.

  • Using custom http headers in SOAP sender adapter

    Hi,
    my problem is exactly the same as reported [here|Re: SOAP Sender - Extract Header Values;] and [here|Variable Transport Binding - Soap Sender;
    Basically I'd like to send through the soap sender adapter some custom http headers. I check the necessary options in the advanced tab (set adapter-specific message attributes and variable transport binding), and in the variable header one I put x-StoreCode, which is the same http header I send to PI.
    But I won't see anything in the dynamic configuration section when the message is persisted in PI.
    Very surprised that I've seen this issue is a common problem others have faced before without success.
    Thanks!

    Hi Michal,
    the extra info I'm trying to send separated from the message is an http header, not part of the query string.
    If I incorporate the extra info as a parameter to the query string like this, for example:
    http://host:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=S1&receiverParty=&receiverService=&interface=Int&interfaceNamespace=urn:test&x-StoreCode=13&nosoap=true
    Then I can see the value in the dynamic configuration section:
    <SAP:Record namespace="http://sap.com/xi/XI/System/SOAP" name="SQueryString">senderParty=&senderService=S1&receiverParty=&receiverService=&interface=Int&interfaceNamespace=urn:test&x-StoreCode=13&nosoap=true</SAP:Record>
    But what I'm trying to do shoould be possible, according to sap help:
    http://help.sap.com/saphelp_nwpi71/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm (section Define Adapter-Specific Message Attributes)

  • How to set Custom HTTP headers in HTTP binding?

    How to set custom HTTP headers before sending the Rest based request in HTTP binding?

    sharon38_74 wrote:
    they said that our internal application needs to send a "login request" to etran via SSL with the user's information encoded in base 64 format. etran captures the HTTP header containing user authentication and authorization information, and parses the required information from the HTTP header.
    My question is that how I set user information in HTTP header? From my understanding, once I am able to set the user information in HTTP header, it is in base 64 format?Your application need to act like a proxy. You can invoke a HTTP request programmatically using java.net.URLConnection. You can set request headers using URLConnection#setRequestProperty(). Also see the API docs: [http://java.sun.com/javase/6/docs/api/java/net/URLConnection.html]. You only need to know the header field name where to set the Base64-encoded value in. You need to Base64-encode the value yourself.

  • Adding custom http headers for WSRP requests

    Hello,
    I wonder whether it is possible to insert custom http headers for WSRP
    requests?
    To give more details:
    We are going to have portlets exposed via WSRP (hosted on non-weblogic
    server). We need these portlets to work on different portals including
    WebLogic Portal. And we need to have working SSO. There needed at least
    2 SSO options:
    1. Having SiteMinder protected portal. Will WebLogic pass SiteMinder
    headers further to WSRP producer?
    2. Custom SSO tokens to be passed as http headers. Is it possible to
    make weblogic to add custom http headers when calling producer?
    2a. Credential mapping shall be used to get username/password for
    backend application (accessed from producer side), and than these
    username/password shall be passed as http headers when requesting producer.
    Best regards,
    Sviatoslav Sviridov

    Hi,
    About how to use Rest API via node.js, please refer to
    http://stackoverflow.com/questions/5643321/how-to-make-remote-rest-call-inside-node-js-any-curl for more information. Hope this helps.
    Best Regards
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Setting Custom HTTP headers

    Hi, is there a way to set custom http headers at server or webapplication level
    on weblogic 60, instead of programmatically setting them on each page? If so how.
    Thanks.

    Well we need to set a custom header for all http requests to the weblogic server.
    If we could set it at the server level, instead of modifying all the pages served
    by the webserver that would be best and most efficient. Here is a link that describes
    it and how other webservers handle it. http://webmaster.info.aol.com/headers.html.
    Currently apache, iis, and netscape webservers allow u to define custom http headers
    at the server level. Thanks.
    "Mark Griffith" <[email protected]> wrote:
    Nope. Can you give me a scenario, use-case? And do other WS handle
    this,
    if so how?
    cheers
    mbg
    "Diana" <[email protected]> wrote in message
    news:3ec01580$[email protected]..
    Hi, is there a way to set custom http headers at server or webapplicationlevel
    on weblogic 60, instead of programmatically setting them on each page?If
    so how.
    Thanks.

  • JSF - Best Practice For Using Managed Bean

    I want to discuss what is the best practice for managed bean usage, especially using session scope or request scope to build database driven pages
    ---- Session Bean ----
    - In the book Core Java Server Faces, the author mentioned that most of the cases session bean should be used, unless the processing is passed on to other handler. Since JSF can store the state on client side, i think storing everything in session is not a big memory concern. (can some expert confirm this is true?) Session objects are easy to manage and states can be shared across the pages. It can make programming easy.
    In the case of a page binded to a resultset, the bean usually helds a java.util.List object for the result, which is intialized in the constructor by query the database first. However, this approach has a problem: when user navigates to other page and comes back, the data is not refreshed. You can of course solve the problem by issuing query everytime in your getXXX method. But you need to be very careful that you don't bind this XXX property too many times. In the case of querying in getXXX, setXXX is also tricky as you don't have a member to set. You usually don't want to persist the resultset changes in the setXXX as the changes may not be final, in stead, you want to handle in the actionlistener (like a save(actionevent)).
    I would glad to see your thought on this.
    --- Request Bean ---
    request bean is initialized everytime a reuqest is made. It sometimes drove me nuts because JSF seems not to be every consistent in updating model values. Suppose you have a page showing parent-children a list of records from database, and you also allow user to change directly on the children. if I hbind the parent to a bean called #{Parent} and you bind the children to ADF table (value="#{Parent.children}" var="rowValue". If I set Parent as a request scope, the setChildren method is never called when I submit the form. Not sure if this is just for ADF or it is JSF problem. But if you change the bean to session scope, everything works fine.
    I believe JSF doesn't update the bindings for all component attributes. It only update the input component value binding. Some one please verify this is true.
    In many cases, i found request bean is very hard to work with if there are lots of updates. (I have lots of trouble with update the binding value for rendered attributes).
    However, request bean is working fine for read only pages and simple binded forms. It definitely frees up memory quicker than session bean.
    ----- any comments or opinions are welcome!!! ------

    I think it should be either Option 2 or Option 3.
    Option 2 would be necessary if the bean data depends on some request parameters.
    (Example: Getting customer bean for a particular customer id)
    Otherwise Option 3 seems the reasonable approach.
    But, I am also pondering on this issue. The above are just my initial thoughts.

  • Reset JSF session and the managed beans with sesison scope

    Hi,
    this is a very general question and maybe stupid for most of you. I have my jsf/facelets web application and i use inside of this application some managed beans, which are session beans. I want to know how is it possible to reset this beans. I'm asking this question beacuse i have this kind of problem: i built my web application which has a login form and i use the browser to test it. When i browse to the login page and I login with my credentials i get my customized home page. Then i open another istance of the browser and i browse to the login page again but this time i login as a different user. The result home page is the same as i got before with my login credentials, so the session is always the same. Instead i want the session and all its objects to be resetted for the new user! Do youn know which is the solution?

    The fact is that i want to have two sessions in parallel, so using the same browser and opening two tabs, i want to browse to the login page and access as two totaly different users and using in parallel the application without the problem of one user's action affecting the other user beacuse of session sharing. So I want to force the application to create two different session for the two users logins, because as i told you before as it is now, they are sharing the same sesison. And i think that if i at the login time I iterate thorugh the session and delete all the objects i will be able to have only one session per time. Isn't it?

  • Problems integrating JSF managed bean with Session EJB with JDeveloper

    HI All,
    I am developeing a JSF-EJB application using Jdeveloper11g. On deploying the application I am getting the following errors on deployment.
    <19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1282193629318' for task '17'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    >
    <19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for the application 'data-catalog'.>
    <19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'data-catalog'.>
    <19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    Thanks
    Edited by: user5108636 on 18/08/2010 22:46

    Please find attached the source code of JSF managed bean, local business interface, session bean and web.xml
    MANAGED BEAN_
    package view.backing;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.faces.component.UISelectItems;
    import javax.faces.component.html.HtmlSelectManyListbox;
    import model.ejb.session.MetaDataBean;
    public class SearchMetaDataBean {
    @EJB MetaDataBean metaDataService;
    private List<String> tables;
    private List<String> columns;
    private HtmlSelectManyListbox selectManyListbox1;
    private UISelectItems selectItems1;
    public void setTables(List<String> tables) {
    this.tables = tables;
    public List<String> getTables() {
    return metaDataService.getTables();
    public void setColumns(List<String> columns) {
    this.columns = columns;
    public List<String> getColumns() {
    return columns;
    public void setSelectManyListbox1(HtmlSelectManyListbox selectManyListbox1) {
    this.selectManyListbox1 = selectManyListbox1;
    public HtmlSelectManyListbox getSelectManyListbox1() {
    return selectManyListbox1;
    public void setSelectItems1(UISelectItems selectItems1) {
    this.selectItems1 = selectItems1;
    public UISelectItems getSelectItems1() {
    return selectItems1;
    LOCAL INTERFACE_
    package model.ejb.session;
    import java.util.List;
    import javax.ejb.Local;
    @Local
    public interface MetaDataLocal {
    public List<String> getTables();
    public List<String> getColumns(String tableName);
    SESSION BEAN_
    package model.ejb.session;
    import javax.ejb.Local;
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.annotation.Resource;
    import javax.ejb.Stateless;
    import javax.sql.DataSource;
    @Stateless(name="MetaData")
    @Local
    public class MetaDataBean implements MetaDataLocal{
    @Resource(name="jdbc/DWDS")
    private DataSource dataSource;
    private Connection connection;
    private List<String> tables = new ArrayList<String>();
    private List<String> columns = new ArrayList<String>();
    private DatabaseMetaData dmd;
    @PostConstruct
    public void initialize(){
    try{
    connection = dataSource.getConnection();
    DatabaseMetaData dmd;
    dmd = connection.getMetaData();
    }catch(SQLException sqle){
    sqle.printStackTrace();
    public MetaDataBean() {
    public List<String> getTables(){
    try{                 
    if (dmd ==null){
    //System.out.println("Database meta data not available");
    tables.add("None");
    }else{
    ResultSet rs = dmd.getSchemas();
    ResultSet rs1 = null;
    while(rs.next()) {
    if (rs.getString(1).equalsIgnoreCase("AV_DATA")){
    rs1 = dmd.getTables(null,rs.getString(1),"%",null);
    while(rs1.next()) {
    tables.add(rs1.getString(3));
    }catch (SQLException sqle){
    sqle.printStackTrace();
    return tables;
    public List<String> getColumns(String tableName){
    try{
    ResultSet rsColumns = dmd.getColumns("", "AV_DATA", tableName, null);
    while(rsColumns.next()){
    columns.add(rsColumns.getString(4));
    }catch (SQLException sqle){
    sqle.printStackTrace();
    return columns;
    WEB.XML_
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <ejb-local-ref>
    <ejb-ref-name>MetaData</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>model.ejb.session.MetaDataLocal</local>
    <ejb-link>MetaDataBean</ejb-link>
    </ejb-local-ref>
    </web-app>
    Edited by: user5108636 on 18/08/2010 22:45
    Edited by: user5108636 on 18/08/2010 22:46

Maybe you are looking for

  • Oracle 11g "Oracle Database Configuration Assistant" failed

    Hi am trying to install oracle 10g databse . am getting Configuration assistant "Oracle Database Configuration Assistant" failed in log file i see [Thread-19] [18:32:29:343] [BasicStep.execute:202] Executing Step : CLONE_DB_CREATION_RMAN_RESTORE [Thr

  • Building the ultimate error email...

    Hello, I'm using CFERROR to catch exceptions and generate an email to myself. I use to have all the basic #error.foo# variables in the email, but I wanted more. So I figured out how you can include most of what is in the classic.cfm template located

  • If i upgrade to mavericks... will logic pro 9, still work???

    i use mountain lion, and i bought logic pro 9 from the app store a few months ago, if i upgrade to mavericks will logic still work? or will i need to download logic ten? and spend another £140? thanks Harry

  • Creating View or  Pivot Table

    I have a query: SELECT circ.facilityid FROM ADMGID.CIRCUITSOURCE_DB CIRC, ADMGID.MINIRETICULATED_DB MN WHERE CIRC.DISTGRP_FID = MN.DISTGRP_FID AND Mn.Facilityid = 'NBRG 0002 0009' return me data , ever 4 rows BRG 0207 BRG 0210 BRG 0208 BRG 0209 of co

  • My Backup/Sync does not work

    1. I am using a macbook 2. When I click on the "Backup/Sync Now" button it says that everything is synchronized. 3. The albums with files needing backup/synchronization and the individual files themselves display the backup/sunchronization pending sy