Java Reference
In-Depth Information
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try{
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(xmlInputStream),
new XSLTInputSource(xslFileName),
new XSLTResultTarget(outputStream));
}catch(Exception e){
System.err.println(e);
}
return outputStream.toByteArray();
}
public static void main(String args[]){
File f = new File("Detail.html");
int id = 1000;
DetailPageXMLBean xmlBean = new DetailPageXMLBean();
DetailPageTransformBean transformBean = new
DetailPageTransformBean();
xmlBean.setId(id);
transformBean.setXslFileName("DetailPage.xsl");
try {
FileOutputStream fos = new FileOutputStream(f);
fos.write(transformBean.applyTransform(xmlBean.getVehicleData()));
}catch(Exception e){
e.printStackTrace();
}
}
}
Assuming you have deployed everything correctly, you should see a Web page that looks like Figure
15-3 when you call the JSP page. The simplest way to do this for checkout purposes is with a simple
HTML form, like the following:
Search WWH ::




Custom Search