This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes how to convert .jsp to .java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

how to convert .jsp to .java

jerry cowell

Joined: Apr 29, 2010
Posts: 7
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("\">\n<input type=\"hidden\" name=\"currency\" value=\"");
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_timestamp\" value=\"");
sb.append("\">\n<input type=\"hidden\" name=\"merchantID\" value=\"");
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_signaturePublic\" value=\"");
sb.append("\">\n<input type=\"hidden\" name=\"orderPage_version\" value=\"4\">\n");
sb.append("<input type=\"hidden\" name=\"orderPage_serialNumber\" value=\"");
return sb.toString();
} catch (Exception e) {
return "";
Jan Cumps

Joined: Dec 20, 2006
Posts: 2497

"always jerry", you have been asked before to correct your name. Please do so before continuing to post questions.

OCUP UML fundamental and ITIL foundation
youtube channel
Jan Cumps

Joined: Dec 20, 2006
Posts: 2497

... and closing this duplicate post.
It is sorta covered in the JavaRanch Style Guide.
subject: how to convert .jsp to .java