473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

JSP to ASP.NET can any one answer!

37
Hi,

Is it possible to convert the following JSP code to ASP.NET?

Expand|Select|Wrap|Line Numbers
  1. <%--
  2.  
  3.  
  4.     Exactly 2 parameters need to be set
  5.     1) format
  6.     2) filename
  7.  
  8. --%>
  9.  
  10. <%@page import="java.io.*,java.net.URLDecoder,emaxon.formats.MolImporter,emaxon.struc.Molecule"%>
  11. <%
  12. try {
  13.     // Retrieving GET/POST parameters
  14.     String format = request.getParameter("format");
  15.     if(format == null) {
  16.         throw new Exception("Format needs to be specified.");
  17.     }
  18.     String filename = null;
  19.     String molstring = null;
  20.     if((filename = request.getParameter("file")) == null) {
  21.         if((molstring = request.getParameter("mol")) == null) {
  22.         throw new Exception("Structure needs to be specified.");
  23.     }
  24.     }
  25.  
  26.     // Setting content type
  27.     String type = format.indexOf(":") == -1 ? 
  28.         format : format.substring(0, format.indexOf(":"));
  29.     response.setContentType("image/" + type);
  30.  
  31.     // Creating the molecule
  32.     Molecule mol = null;
  33.     if(molstring == null) {
  34.         // Reading the file
  35.         File f = new File(filename);
  36.         MolImporter mi = new MolImporter(f,"");
  37.         mol = mi.read();
  38.     } else {
  39.         // Reading the posted SMILES string
  40.     mol = MolImporter.importMol(molstring);
  41.     }
  42.  
  43.     // Calculate the coordinates if needed (for example
  44.     // if the input is SMILES)
  45.     if(mol.getDim()==0) {
  46.         mol.clean(2, "O1");
  47.     }
  48.  
  49.     // Generating the image
  50.     byte[] b = mol.toBinFormat(format);
  51.     ServletOutputStream outs = response.getOutputStream();
  52.     outs.flush();
  53.     outs.write(b,0,b.length);
  54.     outs.close();
  55. } catch(Throwable t) {
  56.     t.printStackTrace();
  57. }
  58. %>
Feb 22 '07 #1
3 1330
r035198x
13,262 8TB
Hi,

Is it possible to convert the following JSP code to ASP.NET?

Expand|Select|Wrap|Line Numbers
  1. <%--
  2.  
  3.  
  4. Exactly 2 parameters need to be set
  5. 1) format
  6. 2) filename
  7.  
  8. --%>
  9.  
  10. <%@page import="java.io.*,java.net.URLDecoder,emaxon.formats.MolImporter,emaxon.struc.Molecule"%>
  11. <%
  12. try {
  13. // Retrieving GET/POST parameters
  14. String format = request.getParameter("format");
  15. if(format == null) {
  16.     throw new Exception("Format needs to be specified.");
  17. }
  18. String filename = null;
  19. String molstring = null;
  20. if((filename = request.getParameter("file")) == null) {
  21.     if((molstring = request.getParameter("mol")) == null) {
  22.      throw new Exception("Structure needs to be specified.");
  23.     }
  24. }
  25.  
  26. // Setting content type
  27. String type = format.indexOf(":") == -1 ? 
  28.      format : format.substring(0, format.indexOf(":"));
  29. response.setContentType("image/" + type);
  30.  
  31. // Creating the molecule
  32. Molecule mol = null;
  33. if(molstring == null) {
  34. // Reading the file
  35. File f = new File(filename);
  36. MolImporter mi = new MolImporter(f,"");
  37. mol = mi.read();
  38. } else {
  39. // Reading the posted SMILES string
  40.     mol = MolImporter.importMol(molstring);
  41. }
  42.  
  43. // Calculate the coordinates if needed (for example
  44. // if the input is SMILES)
  45. if(mol.getDim()==0) {
  46. mol.clean(2, "O1");
  47. }
  48.  
  49. // Generating the image
  50. byte[] b = mol.toBinFormat(format);
  51. ServletOutputStream outs = response.getOutputStream();
  52. outs.flush();
  53. outs.write(b,0,b.length);
  54. outs.close();
  55. } catch(Throwable t) {
  56. t.printStackTrace();
  57. }
  58. %>
It is possible to achieve the same functionality in ASP.NET. What you need to do is write down your program logic in pseude code then try try to write the ASP code for it.
Feb 22 '07 #2
ozzii
37
It is possible to achieve the same functionality in ASP.NET. What you need to do is write down your program logic in pseude code then try try to write the ASP code for it.
I simply need to convert the above jsp script to asp. I am not familiar with JSP syntax which is why i am unable to convert the logic my self.

Does anybody have the microsoft java language conversion assistant tool to convert the above code for me? I know its available to download for free but i need visual studio 2005 package to run it!
Feb 22 '07 #3
r035198x
13,262 8TB
I simply need to convert the above jsp script to asp. I am not familiar with JSP syntax which is why i am unable to convert the logic my self.

Does anybody have the microsoft java language conversion assistant tool to convert the above code for me? I know its available to download for free but i need visual studio 2005 package to run it!
Oh, so you don't want to write the code but want to use a software package to convert the codes? Maybe someone else will help you then. I prefer helping those actually writing the code.
Feb 22 '07 #4

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

Similar topics

3
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
4
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
9
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
33
by: Nigel Molesworth | last post by:
I've Googled, but can't find what I need, perhaps I asking the wrong question! I want a "FAQ" page on a web site, I hate those pages that scroll you to the answer so and I figured that a good...
2
by: amelia170 | last post by:
I am creating a database with a yes or no answer for question 1. Based on that answer, (if they answer yes) they will answer question 2, then three....However, if they answer no to question one, I...
14
by: Peter Mount | last post by:
Hello I'm having trouble with " scanf("%c", &answer);" on line 20 below. When I run the program in cygwin on Windows 98SE it skips that line completely and ends the program. Does scanf have...
12
by: Bernie Yaeger | last post by:
I asked two fairly simple questions, or so I thought, but have received no ideas at all. 1. What is the control that MS uses in Outlook Express that contains attachments? It appears to be a...
2
by: windsorben | last post by:
I'd like to have an image appear after the student answers each short answer question correctly. I can't seem to get it to work properly. See code below. Thanks! <html> <head>...
2
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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,...
0
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...
0
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...

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.