XSLT In JSP : XML « JSP « Java






XSLT In JSP

/*
  Java, XML, and Web Services Bible
  Mike Jasnowski
  ISBN: 0-7645-4847-6
*/


<HTML>
<H1> Enter card Info</H1>
<FORM NAME="CARDINFO" ACTION="/test/svgcard/process.jsp" TARGET="VIEWCARD">
<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="2">
<TR><TD>Card To:</TD><TD><INPUT TYPE="TEXT" SIZE="20" NAME="cardto"></TD></TR>
<TR><TD>Card From:</TD><TD><INPUT TYPE="TEXT" SIZE="20" NAME="cardfrom"></TD></TR>
<TR><TD>Message:</TD><TD><INPUT TYPE="TEXT" SIZE="60" NAME="message"></TD></TR>
<TR><TD COLSPAN="2">&nbsp;</TD></TR>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="PREVIEW"></TD><TD>&nbsp;</TD>
</TABLE>
</FORM>
</HTML>



<%@ page contentType="image/svg-xml" %>

<%

String cardTo = request.getParameter("cardto");
String cardFrom = request.getParameter("cardfrom");
String message = request.getParameter("message");

%>
<svg width="400" height="200">
<g style="font-family:Arial;font-size:12pt;">
 <text x="10" y="20">
    <%= cardTo %>, someone has sent you a message
 </text>
 <text x="10" y="60">
    <%= cardFrom %> would like to tell you
 </text>
 <text x="10" y="140">
    <%= message %>
 </text>
</g>
</svg>

           
       








Related examples in the same category

1.Using the Core XML tags
2.XML transformation
3.Performing XSL Transformations
4.JSP in pure XML generating conforming XHTML
5.XSLT in JSP 2
6.JSP Parsing using the DOM
7.JSP Parsing using JDOM
8.JSP Parsing using the DOM and JSTL
9.JSP and SAX
10.JSP Displaying a Subset in XML
11.JSP XML and XSLT transform
12.JSP List of data in the XML document
13.Deal With XML In JSP