473,508 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert this jsp code to asp

9 New Member
i have code in jsp but the problem is i need to convert this to asp.........pleasehelp me regarding this im sending code which i've have....with file names..........

code.jsp

<%@ page import = "java.util.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.lang.*" %>
<%@ page import = "org.apache.commons.fileupload.*" %>
<%@ page import = "java.sql.*" %>
<%
try{
Connection con = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
String user="scott";
String password="tiger";
System.out.println("errrrrrrrrr");
con=DriverManager.getConnection("jdbcracle:thin:@l ocalhost:1521:welcome",user,password);
System.out.println("errrrrrrrrragain");
String name = null;
int icon = 0;
String name1=null,country1=null,state1=null,gender1=null, age1=null,pref_lang1=null,emailid1=null,comment1=n ull,story1=null,url=null;

File uploadFile=null;
response.setContentType("text/html");
DiskFileUpload df=new DiskFileUpload();
List items=df.parseRequest(request);
Iterator iter=items.iterator();
while(iter.hasNext())
{
FileItem item=(FileItem)iter.next();
if(item.isFormField())
{
name=item.getFieldName();
if(name.equals("name"))
{
name1=item.getString();
}
else if(name.equals("country"))
{
country1=item.getString();

}
else if(name.equals("state"))
{
state1=item.getString();
}
else if(name.equals("gender"))
{
gender1=item.getString();
}
else if(name.equals("age"))
{
age1=item.getString();
}
else if(name.equals("language"))
{
pref_lang1=item.getString();
}
else if(name.equals("emailid"))
{
emailid1= item.getString();
}
else if(name.equals("comment"))
{
comment1= item.getString();
}
else if(name.equals("story"))
{
story1= item.getString();
}
}

else
{
String locPath = item.getString();
String subPath = locPath.substring(0,locPath.indexOf("."));
url ="c:\\bhanu\\"+name1+".jpeg";
uploadFile=new File(url);
item.write(uploadFile);
out.println("File Uploaded Successfully.......");
}
}
PreparedStatement stmt = con.prepareStatement("insert into join_us values(?,?,?,?,?,?,?,?,?,?)");
stmt.setString(1,name1);
stmt.setString(2,country1);
stmt.setString(3,state1);
stmt.setString(4,gender1);
stmt.setString(5,age1);
stmt.setString(6,pref_lang1);
stmt.setString(7,emailid1);
stmt.setString(8,comment1);
stmt.setString(9,story1);
stmt.setString(10,url);
stmt.executeUpdate();
out.println("Your details has been uploaded");
session.setAttribute("name","name1");
RequestDispatcher rd = request.getRequestDispatcher("codeDisplay.jsp");
rd.forward(request,response);
}
catch(Exception e){
System.out.println("errrrrrrrrr");
e.printStackTrace();
}

%>

codeDisplay.jsp


<HTML>
<HEAD>
</HEAD>
<%@page import="java.sql.*"%>
<BODY bgcolor="#000000"><center>
<marquee bgcolor="#CC6699"><b>STOP TEARS</b></marquee><BR><BR><BR>
<h2><font color="#993366">STOP TEARS</font></h2>
<!--<form action="code.jsp" method="post" >-->

<% String strName=null,strCountry=null,strState=null,strGend er=null,strLang=null,strEmail=null,strComment=null ,strStory=null,strImage=null,strAge=null;
%>
<%try{ String name = (String) session.getAttribute("name");
Connection con=null;
Statement stmt=null;
DriverManager.registerDriver((Driver) Class.forName("oracle.jdbc.driver.OracleDriver").n ewInstance());
con=DriverManager.getConnection("jdbcracle:thin:@l ocalhost:1521:welcome","scott","tiger");
stmt=con.createStatement();
//retriving data from database
ResultSet rs=stmt.executeQuery("select * from join_us");
while(rs.next()){
// ResultSet rs=stmt.executeQuery("select * from join_us");
strName = ""+rs.getString(1);
strCountry = rs.getString(2);
strState = rs.getString(3);
strGender = rs.getString(4);
strAge = rs.getString(5);
strLang = rs.getString(6);
strEmail = rs.getString(7);
strComment = rs.getString(8);
strStory = rs.getString(9);
strImage = rs.getString(10);

}//while close

}//try close
catch(Exception e){e.printStackTrace();}
%>
<table border=1 width="929" height="411">
<tr><th width="805" height="1"><font color="#669900">Personal Details</font></th></tr>
<tr><td width="805" height="102">
<IMG
border="0" src=<%=strImage%> width="125" height="100"><b><font color="#CC9900">Name</font><INPUT readonly type='text'name='Name' value='<%=strName%>' size="32"></b><font color="#CC9900"><b>Country<INPUT readonly type='text' name='Country' value='<%=strCountry%>' size="20">
State<INPUT readonly type='text'name='State' value='<%=strState%>' size="20">
</b></font>
<p><font color="#CC9900"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; Gender<INPUT readonly type='text'name='Gender' value='<%=strGender%>' size="10"> Age<INPUT readonly type='text'name='Age' value='<%=strAge%>' size="5"> Language<INPUT readonly type='text'name='' value='<%=strLang%>' size="20"> Email-id<INPUT readonly type='text'name='' value='<%=strEmail%>' size="20">
</b></font></p>
<p><font color="#CC9900"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp; Comment<INPUT readonly type='textarea' name='' value='<%=strComment%>' size="85">
</b></font></p>
<p><font color="#CC9900"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp; Story<INPUT readonly type='textarea' name='' value='<%=strStory%>' size="89">
</b></font></p>
<p>&nbsp;</td>
</tr>

</table>


</body>
</html>
Dec 29 '06 #1
0 1074

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3601
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
4
9703
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
6
10136
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
5
18695
by: simon | last post by:
I have datetime variable: Datetime tsEndTime; Should I use (DateTime): tsEndTime=(DateTime)rdr.GetValue(15) or is better to use: tsEndTime=Convert.ToDateTime(rdr.GetValue(15))
3
2682
by: Thubaiti | last post by:
Hi, I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategoryRepeater" runat="server"> <ItemTemplate> <ul> <li> <asp:HyperLink...
25
7221
by: Charles Law | last post by:
I thought this was going to be straight forward, given the wealth of conversion functions in .NET, but it is proving more convoluted than imagined. Given the following <code> Dim ba(1) As...
7
29157
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
1407
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
3
8723
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; ...
0
10706
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.