Friday, 1 July 2016

Struts 2 Questions

1.How Struts 2 validation works?
When the user presses the submit button, Struts 2 will automatically execute the validate method and if any of the if statements listed inside the method are true, Struts 2 will call its addFieldError method. If any errors have been added then Struts 2 will not proceed to call the execute method. Rather the Struts 2 framework will return input as the result of calling the action.
So when validation fails and Struts 2 returns input, the Struts 2 framework will redisplay the view file. Since we used Struts 2 form tags, Struts 2 will automatically add the error messages just above the form filed.
These error messages are the ones we specified in the addFieldError method call. The addFieldError method takes two arguments. The first is the form field name to which the error applies and the second is the error message to display above that form field.

Wednesday, 13 January 2016

BI Publisher

1.How to generate report in PDF directly instead of from HTML to PDF in BI Publisher from Browser?


Hi All,
One solution has been found to generate the report directly in PDF format instead of generating the from html to PDF.

Steps to follow are below.
A.Open the file “_report.xdo” which will be located in the <Report_Name>.xdo  folder EX: DetailedCustomerReportAdhoc.xdo
In file search for “label” in that line change the below attributes.
                        1.From outputFormat="html,pdf,rtf,xlsx,pptx" to outputFormat="pdf"
                        2.From defaultFormat="html" to defaultFormat="pdf"
For Ex:
Change From below line
<template label="test1" url="DetailedCustomerReportAdhoc1.rtf" type="rtf" outputFormat="html,pdf,rtf,xlsx,pptx" defaultFormat="html" locale="en_US" disableMasterTemplate="true" active="true" viewOnline="true"/>
To
            <template label="test1" url="DetailedCustomerReportAdhoc1.rtf" type="rtf" outputFormat="pdf" defaultFormat="pdf" locale="en_US" disableMasterTemplate="true" active="true" viewOnline="true"/>

B.After changing the file Go to catalog select the required report and click on edit as shown below


C.After that click on save button and click View Report as shown below




If still the report is getting viewed directly in HTML. Check the _report.xdo file where the Step 1 done changes are there are not.
If not please follow once again the steps mentioned above.


2.Useful Links for BIP
http://bipublisher.blogspot.in/2012/02/bi-publisher-xdotop-msword-debugging.html


2. How to Set up the Debug On for BIPUBLISHER?
Steps to Turn ON Logging for BI Publisher for Reports debugging

1.Create a folder xdolog and place it under

<Middleware_Home>/user_projects/domains/bifoundation_domain/config/bipublisher

This has to be used in LogDir parameter in step 2.

Note: The above mentioned path is optional .You can create it anywhere

2.Create a file named xdodebug.cfg and place it under

<Middleware_Home>/Oracle_BI1/jdk/jre/lib/

3.Add below listed lines in xdodebug.cfg file

Under Windows

LogLevel=STATEMENT
LogDir=c:\<Middleware_Home>\user_projects\domains\bifoundation_domain\config\bipublisher\xdolog

Under Unix:

LogLevel=STATEMENT
LogDir=<Middleware_Home>/user_projects/domains/bifoundation_domain/config/bipublisher/xdolog

4.Retest the issue

5.Check the files created in the specified LogDir (xdolog) directory.Here you can see XDO.log
6.Remove xdodebug.cfg when finished replicating the issue.


The logging is specifically useful for troubleshooting the Template(RTF/PDF) or Data File(XML file) specific issues. The generated XML file is the actual data file which is run from the MS Word Design Helper Preview mode to narrow down the issue.

3.How to create dynamic query execution in BI Publisher?
In the XDM we have so many DATASETS. Based on some parameters we can have conditional query preparation and execution.

SYNTAX:
                        create sql dataset with following query
                        $if{ (:PARAM == VALUE) }$
                 select 'ravi' as X from dual
            $elsif{(:PARAM == VALUE1 )}$
                 select 'kale' as Z from dual
            $else{
                 select 'TEJ' as Y from dual
            }$
            $endif$

POINTS TO REMEBER:
1. At least One if and one else is mandatory
2.We should not use the double quotes(") or single quotes ('), if the VALUE is string or character.
    EX: a. ravi    --> Correct 
           b. 'ravi'   --> Not Correct
           c. "ravi"  --> Not Correct

EXPLANATION:
While the XDM is exectuing when the above code encounters then the when the inputted parameter is equal value i.e, when the condition satisfies then only the corresponding query executes. Not all the queries executes.

4.How to show Images in generated PDF using RTF Template?
We have 4 solutions. Those solution are available in My Google Drive (BI Publisher/dynamicImages.zip)

Simplest way to display Server Time in JSP using js

THE BELOW CODE WORKS ONLY IN JSP : <html> <body > <table width="95%" border="1" cellpadding="1...