• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

asp to jsp

 
alec stewart stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i write the following code in jsp.i mean to say that can anyone give me the equivalent code for jsp:
<% Response.ContentType ="text/xml" %>
<?xml version="1.0" ?>
<%
dim xmldoc
dim root
dim onode
set xmldoc=Server.CreateObject("Microsoft.XMLDOM")
if xmldoc.childNodes.length=0 then
set root=xmldoc.createnode("element","CUSTOMERDEF","")
xmldoc.appendChild(root)
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB;Initial Catalog=school;Data Source=ddixit;UID=sa"
sql="select country_id,country_value from country"
set rs=conn.Execute(sql)
rs.MoveFirst()
while (not rs.EOF)
set onode=xmldoc.CreateNode("element","CUSTOMER","")
xmldoc.documentElement.appendChild(onode)
for i=0 to rs.fields.count-1
if rs.fields(i).name=country_id then
else
set child=xmldoc.createNode("element",rs.fields(i).Name,"")
child.text=rs.fields(i)
onode.appendChild(child)
end if
next
rs.MoveNext()
Wend
end if
Response.Write(xmldoc.xml)
xmldoc.Save(Server.MapPath("customer.xml") )
%>
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Assuming that you know an ASP)
If I give you a JSP can you convert it into an ASP?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64992
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps the best approach would be to take a stab it and to ask questions about any portions that have you bamboozled.
[ February 26, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64992
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, when posting code please be sure to use the UBB code tags so that the original formatting of the code is perserved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic