This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes asp to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "asp to jsp" Watch "asp to jsp" New topic
Author

asp to jsp

alec stewart stewart
Ranch Hand

Joined: Dec 23, 2003
Posts: 71
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

Joined: May 30, 2002
Posts: 1400
(Assuming that you know an ASP)
If I give you a JSP can you convert it into an ASP?


- Varun
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Also, when posting code please be sure to use the UBB code tags so that the original formatting of the code is perserved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: asp to jsp
 
Similar Threads
problem in getting child node
xml tags writing
Hibernate Newbie - 1 to Many Relation Tutorial
XML and Lotus Domino R5.0
raw xml as the payload