Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to convert .jsp to .java

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi experts,

please help me out. i am a newbie.
I really appreciate your time, can you please give me an example of how i can translate this .jsp file code below to a .java file, what will your .java file look like after translating the below code ?
my aim is to translate the .jsp into .java and convert .java to .class and invoke the .class file from an ERP program.

*************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@ page import="sun.misc.BASE64Encoder, javax.crypto.*, javax.crypto.spec.*"%>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="java.util.Map" %>

<%!
public String insertSig(String amount, String currency) {
try {
if (amount == null) {
amount = "0.00";
}
if (currency == null) {
currency = "usd";
}
String time = String.valueOf(System.currentTimeMillis());
String merchantID = getMerchantID();
String data = merchantID + amount + currency + time;
BASE64Encoder encoder = new BASE64Encoder();
.......
......
String publicDigest = encoder.encodeBuffer(publicBytes);
publicDigest = publicDigest.replaceAll("\n", "");
StringBuffer sb = new StringBuffer();
sb.append("<input type=\"hidden\" name=\"amount\" value=\"");
sb.append(amount);
sb.append("\">\n<input type=\"hidden\" name=\"currency\" value=\"");
sb.append(currency);
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_timestamp\" value=\"");
sb.append(time);
sb.append("\">\n<input type=\"hidden\" name=\"merchantID\" value=\"");
sb.append(merchantID);
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_signaturePublic\" value=\"");
sb.append(publicDigest);
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_version\" value=\"4\">\n");
sb.append("<input type=\"hidden\" name=\"orderPage_serialNumber\" value=\"");
sb.append(serialNumber);
sb.append("\">\n");
return sb.toString();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
%>
**************************
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
"always jerry", you have been asked before to correct your name. Please do so before continuing to post questions.
 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
... and closing this duplicate post.
 
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic