1. Install Eclipse IDE for JavaEE Developers with WTP support (3.3.x) 2. Download JRE and Application server separately 3. Make sure that Eclipse is pointing to correct Target Run Time (JRE) 4. Add Servers using Window> Show View> Servers > Add > New Server 5. Create a New Web Project using File> New> Project> Web Project 6. Link source folders if source already exist or copy it to default src folder created in step 3 7. Add all 3rd party libraries e.g. Spring, Struts, Hibernate, Log4j 8. Add Ant build script using
//Use this piece of code to generate XML file which has HEADER and BODY parts. //Body can have many rows identified by "TR" elements //Each TR element can have many columns e.g. CL1, CL2, CL3
The code is written using JAXP and SAX. The following imports needs to be included
//Now the following piece of code transforms above generated XML file into Output file with given template file
Source xmlSource = new StreamSource(xmlFile); File finalOutput = new File("Output.doc"); OutputStream out = new FileOutputStream(finalOutput); Result result = new StreamResult(out); TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans; InputStream xsltFile = null; xsltFile = getXSLTInput(); //Get your input template file Source xsltSource = new StreamSource(xsltFile); trans = transFact.newTransformer(xsltSource); trans.transform(xmlSource, result);
Function to read input template file as class via classLoader
1) Div pop-up relative to link. divId - Id for the Div to be used as popup lnk - Id for the link to be used as reference for popup position xOffset - xOffset from the topleft of the ref link yOffset - yOffset from the topleft of the ref link function showPopUp(dispatch,lnk,xOffset, yOffset)
function showPopUp(divId,lnk,xOffset, yOffset) { var el = document.getElementById(lnk); var ol=el.offsetLeft; while ((el=el.offsetParent) != null) { ol += el.offsetLeft; } var el = document.getElementById(lnk); var ot=el.offsetTop; while((el=el.offsetParent) != null) { ot += el.offsetTop; }
var x = ol+xOffset; var y = ot+yOffset; showMe(divId,x,y); }
2) Div pop-up absolute. divId - Id for the Div to be used as popup xOffset - xOffset from the topleft yOffset - yOffset from the topleft function showMe(dispatch,xOffset,yOffset)
function showMe(divId,xOffset,yOffset){ var elm = document.getElementById(divId); elm.style.top=yOffset; elm.style.left=xOffset; elm.style.display=""; elm.style.zIndex = 200;
}
3) Hide the div . divid - Id for the div. function hideMe(divid)
function hideMe(divid){ document.getElementById(divid).style.display="none"; }
4) Make an ajax request url - URL of the server resource data - Data to be used in case of post else empty string. Data passed is in the form of querystring. method - get or post for ajax request submission function serverData(url,data,method)
function serverData(url,data,method) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; }
8) Hides the inProcessScreen function hideInProcess()
function hideInProcess() { document.getElementById('processStatus').style.display = "none"; document.getElementById('inProcess').style.display = "none"; }
9) Initializes the in process screen processingColor - Color for the processing text message filmColor - Color for the processing film to protect parent screen activities during processing processingText - Color of the Text for Processing message processingImgSrc - processing Img function initScreenBlur(processingColor,filmColor,processingText,processingImgSrc)
function initScreenBlur(processingColor,filmColor,processingText,processingImgSrc) { document.write(""); document.write("
"+processingText+"
"); document.write("
"); document.write("
"); }
10) Replaces the processing text message and image with the specified content function replaceProcessingText(replaceText)