Convert C++ prog into Java( I m new in java)help urgent
hi all,
i am very new in java. i have code of C++.i have to convert it in to Java.please help me on urgent basis.plz provide me solution.
I am looking for positive response.code is below:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fstream.h>
#include <iostream.h>
//#include <sha.h> //24112003
//#include<wincrypt.h>
char ntc(unsigned char n){
if (n<26) return 'A'+n;
if (n<52) return 'a'-26+n;
if (n<62) return '0'-52+n;
if (n==62) return '+';
if (n==63)return '/';
unsigned char ctn(char c){
if (c=='/') return 63;
if (c=='+') return 62;
if ((c>='A')&&(c<='Z')) return c-'A';
if ((c>='a')&&(c<='z')) return c-'a'+26;
if ((c>='0')&&(c<='9')) return c-'0'+52;
if (c=='~') return 80;
return 100;
int b64decode(char from,char to,int length){
unsigned char c,d,e,f;
char A,B,C;
int i;
int add;
char *tot=to;
for (i=0;i+3<length;){
add=0;
A=B=C=0;
c=d=e=f=100;
while ((c==100)&&(i<length)) c=ctn(from[i++]);
while ((d==100)&&(i<length)) d=ctn(from[i++]);
while ((e==100)&&(i<length)) e=ctn(from[i++]);
while ((f==100)&&(i<length)) f=ctn(from[i++]);
//if (f==100) return -1; /* Not valid end */
if (c<64) {
A+=c*4;
if (d<64) {
A+=d/16;
B+=d*16;
if (e<64) {
B+=e/4;
C+=e*64;
if (f<64) {
C+=f;
to[2]=C;
add+=1;
to[1]=B;
add+=1;
to[0]=A;
add+=1;
to+=add;
if (f==80) return to-tot; /* end because '=' encountered */
return to-tot;
int b64get_encode_buffer_size(int l,int q){
int ret;
ret = (l/3)*4;
if (l%3!=0) ret +=4;
if (q!=0){
ret += (ret/(q*4));
/* if (ret%(q/4)!=0) ret ++; */ /* Add space for trailing \n */
return ret;
int b64strip_encoded_buffer(char *buf,int length){
int i;
int ret=0;
for (i=0;i<length;i++) if (ctn(buf)!=100) buf[ret++] = buf [i];
return ret;
int b64encode(char from,char to,int length,int quads){
// 3 8bit numbers become four characters
int i =0;
char *tot=to;
int qc=0; // Quadcount
unsigned char c;
unsigned char d;
while(i<length){
c=from[i];
*to++=ntc(c/4);
c=c*64;
i++;
if (i>=length) {
*to++=ntc(c/4);
*to++='~';
*to++='~';
break;
d=from[i];
*to++=ntc(c/4+d/16);
d=d*16;
i++;
if (i>=length) {
*to++=ntc(d/4);
*to++='~';
break;
c=from[i];
*to++=ntc(d/4+c/64);
c=c*4;
i++;
*to++=ntc(c/4);
qc++; /* qz will never be zero, quads = 0 means no linebreaks */
if (qc==quads){
*to++='\n';
qc=0;
/* if ((quads!=0)&&(qc!=0)) to++='\n'; / /* Insert last linebreak */
return to-tot;
char* mEncryptPassword(char* mPassword)
char mEncryptedPassword[200]; // To hold encrypted password.
//char* mEncryptedPassword = new char[200];
char mPrimEncryptedPassword[200];
char * temp = new char[200];
//unsigned char* md; // 19122003
//md = new unsigned char[100]; // 19122003
memset(mEncryptedPassword, '\0', sizeof(mEncryptedPassword));
memset(mPrimEncryptedPassword, '\0', sizeof(mPrimEncryptedPassword));
strcpy(mPrimEncryptedPassword, mPassword);
//strcpy(mPrimEncryptedPassword, (char*) SHA1((unsigned char*) mPassword, strlen(mPassword), NULL));
//strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); // 19122003
//strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); //19122003
b64encode(mPrimEncryptedPassword, mEncryptedPassword, strlen(mPrimEncryptedPassword), 0);
// If successfully encrypts..
if (mEncryptedPassword != NULL)
//char * temp = new char[strlen(mEncryptedPassword)+1];
strcpy(temp,mEncryptedPassword);
// strcpy(mRetVal,mEncryptedPassword);
return (char*)temp;
//return (mEncryptedPassword);
//return (char*) md; // 19122003
else
return ("Error");
char* mDecryptPassword(char* mPassword)
char mDecryptedPassword[200]; // To hold decrypted password.
char mPrimDecryptedPassword[200];
char * temp = new char[200];
// 02032007
memset(mDecryptedPassword, '\0', sizeof(mDecryptedPassword));
memset(mPrimDecryptedPassword, '\0', 200);
strcpy(mPrimDecryptedPassword, mPassword);
b64decode(mPrimDecryptedPassword, mDecryptedPassword, strlen(mPrimDecryptedPassword));
// If successfully decrypts..
if (mDecryptedPassword != NULL)
//char * temp = new char[strlen(mEncryptedPassword)+1];
strcpy(temp,mDecryptedPassword);
// strcpy(mRetVal,mDecryptedPassword);
return (char*)temp;
//return (mEncryptedPassword);
//return (char*) md; // 19122003
else
return ("Error");
void main(int argc, char* argv[])
cout << mEncryptPassword(argv[1])<<endl<<flush;
cout << mDecryptPassword(mEncryptPassword(argv[1]))<<endl<<flush;
Anubhav
endasil wrote:
I just thought of how ridiculous this would sound in any other profession:
Surgeons:
plz plz help I have patient dying need to insert new kidney into 90yr old patient plz someone come do itLawyers:
Help client guilty need good defense (I m new in law)help urgentHow come we get stuck with the lazy low-lifes?Because there's no legal requirement that a software developer must be licensed
Similar Messages
-
How do I convert an MP4 into something usable in FCP? Please help
I am very annoyed. Compressor is something I have. But apparently it's not set up intelligently AT ALL. You'd think it would be quite easy to convert a file into PRORES or HD. I have been looking all over, it's like they are hiding it from us Anyway rant over.
I need to include an mp4 video in a project I am making. MP4 does not work in FCP. I am not trying to download new software. I have FCP and compressor. Is this possible with these 2 softwares? And how do I do it step by step?
Thanks very much in advance for all help.But apparently it's not set up intelligently AT ALL. You'd think it would be quite easy to convert a file into PRORES or HD. I have been looking all over, it's like they are hiding it from us Anyway rant over.
Open up Compressor
At the far right end of the menu bar you 'll see the item "HELP".
Click on it.
From the drop down menu, Select "Compressor Help"
When it opens, Select "Compressor Manual"
When it opens, Select "Getting Started Quickly"
x -
How can I open help file (HTML or .chm) from Java Web Start (new to JAVA)
Hi All,
Im trying to open the help file of my application.
When trying to access the help file from the GUI (pressing F1 for launching the help file), I'm geting the an error, something like:
"Can't show help URL: jar:file:C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart\RMjar-name!/com/resources/helpFiles/MyHelpFile.html"
It seems that the file which is packed in a jar, was downloaded to the Java Web Start cache directory:
C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart
The code which is activated when launching the help file is:
try
ResourceBundle resourceBundle = DoubleResourceBundle.getBundle("Resource", "ResourceImpl");
RuntimeUtil.launchFile(new File(resourceBundle.getString("help.file")));
} catch (IOException e)
// TODO Auto-generated catch block
e.printStackTrace();
}where the property "help.file" is in some property file in the resource bundle named "Resource", and looks like this :
help.file="com/trax/docs/help/global/MyHelpFile.html"
The function "RuntimeUtil.launchFile" knows how to launch any file in its default application, and indeed it does launches the html, when giving it an absolute path to the file on my PC, as "C:\Helpfiles\MyHelpFile.html" as such:
RuntimeUtil.launchFile("C:\Helpfiles\MyHelpFile.html");My question is :
The application is going to be deployed on a Customer PC. How can I access the html file from the code, with a relative path and not its absolute path on the customer pc, which I can't know?
I found these restrictions regarding web start:
(copied from "http://rachel.sourceforge.net/"):
*Rule 1: Java Archives only. No loose files.* All your resources have to be packaged in Java Archives (jar) if you want to have
them delivered to the user's machine and kept up-to-date automatically by Java Web Start.
*Rule 2: No file paths.* You can't use absolute or relative file paths to locate your
jars holding your resources (e.g. <code>jar:file:///c:/java/jws/.cache/resources.jar</code>).
Absolute file paths won't work because you never know where Java Web Start
will put your jar on the user's machine. Relative file paths won't work because Java Web Start
mangles the names of your jars (e.g. <code>venus.jar</code> becomes <code>RMvenus.jar</code>)
and every JNLP client implementation has the right to mangle your names
in a different way and you, therefore, can't predict the name with
which your jar will be rechristend and end up on the user's machine in
the application cache.Seems complex or impossible, to perform a simple task like opening a file.
Please advise (I'm new to Java and Web Start).
BTW, I'm working with IntelliJ IDEA 5.0.
Thanks,
Zedik.
{font:Tahoma}{size:26pt}
{size}{font}the follwing method i have used to open html file ...
so to access html file i am shipping resources folder with jar file ..
private void openHtmlPages(String pageName) {
String cmd[] = new String[2];
String browser = null;
File file = null;
if(System.getProperty("os.name").indexOf("Linux")>-1) {
file = new File("/usr/bin/mozilla");
if(!file.exists() ) {
}else {
browser = "mozilla";
}else {
browser = "<path of iexplore>";
cmd[0] = browser;
File files = new File("");
String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
java.net.URL url = this.getClass().getResource(metaData);
String fileName = url.getFile();
fileName = fileName.replaceAll("file:/","");
fileName = fileName.replaceAll("%2520"," ");
fileName = fileName.replaceAll("%20"," ");
fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
cmd[1] = fileName;
try{
Process p = Runtime.getRuntime().exec(cmd);
}catch(java.io.IOException io){
//Ignore
can anyone give me the solution..???
Regards
Ganesan S -
I justpurchased a mac book air. Switching from a PC, When I log into my itunes account I dont see any of my music or anything. How do I transfer my stuff?
But how did you fix it ????? Pls help me !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - tears of pain and frustration gushes out-
-
Installing Xsan 1.0 on a new tiger system - Help - Urgent
Here's my situation
I purchased a version 1.0 copy of Xsan.
I am trying to install it on a new dual 2.7 G5 with tiger installed.
It says I cannot do this because the version of xsan and tiger are not compatible.
Is there a way to do this, or am I screwed?
Thanks in advance for your help
DBKOk, first what's the version of Tiger? and who sold you a 1.0 version knowing that you were running Tiger? You will need the 1.2 version and then you'll need the 1.3 upgrade from apple.
Please take your time to plan the build of your Xsan and the deployment as well.
Poor planning with this type of software and hardware will come back to bite you!!! -
Converting oracle forms into java forms
Hi all,,
would help me plz on how to convert oracle forms into java using any tool;
Is Jheadstart is the tool,, im having jeveloper version 10.1.2.1.0There are at least two companies that are marketing Forms to Java conversion tools. I'm sure that a good Google search will locate them, and they are frequent exhibitors at Oracle-oriented conferences like Collaborate and ODTUG Kaleidoscope. But there are problems associated with doing this. I urge anyone who is considering such a project to read this article by Grant Ronald: http://www.oracle.com/technology/products/forms/pdf/10gR2/formsmigration.pdf
You should carefully ask yourself and your clients and management, "Why do you want to do this?", "What benefits are you trying to realize?", "Does this make sense, and are there other options that we should be exploring?"
For instance, many people are trying to protect themselves because "Forms is going away". Oracle has stated again and again that Forms is NOT going away. In fact the recent Fusion Middleware 11g release included a new version of Forms with some significant enhancements. You may do very well just by upgrading to the latest version of Forms.
If you do decide that it still makes sense to convert, I suggest that rather that converting, you may want to redevelop from scratch. Keep the database if it is well designed - a well designed, stable database will outlast any front end that you may use against it. Then take full advantage of the capabilities of your new toolset, and leave behind the limitations and inapplicable methodologies of your old one. Oh, by the way, don't use JDeveloper 10.1.2. Use 11g if you can, or 10.1.3.5 if you must. -
How to convert csv files into java bean objects?
Hi,
I have a CSV file, I want to store the data availabale in that csv file into java bean, I am new to this csv files how can I convert CSV files into java beans.
Please help me.
Adavanced Thanks,
MahendraYou can use the java.io API to read (and write) files. Use BufferedReader to read the CSV file line by line. Use String#split() to split each line into an array of parts which were separated by comma (or semicolon). If necessary run some escaping of quotes. Finally collect all parts in a two-dimensional List of Strings or a List of Javabeans.
java.io API: [http://www.google.com/search?q=java.io+javase+api+site:sun.com]
java.io tutorial: [http://www.google.com/search?q=java.io+tutorial+site:sun.com]
Basic CSV parser/formatter example: [http://balusc.blogspot.com/2006/06/parse-csv-upload.html] -
How can I convert my animation into a working movie clip that can be used with a new scene?
Hello all,
First and foremost, I AM A TOTAL FLASH NOOB. I want to preface this and make it incredibly clear how new this all is to me. I LITERALLY started using flash this morning; that is precisely how new I am.
With that being said I am going to do my best to explain what I'd like to do.
I have created an animation of a spider moving its legs back and forth. I want to be able to combine all of the layers into 1 simple animation that can be imported into new flash scenes with the animation exactly how it stands. I have figured out how to convert the whole animation into a symbol AND I have figured out how to import the movie clip from the library. However, herein lies my problem. When I open a new flash scene and import my animation, I play it and it does nothing at all. It's just the static image of the spider I created with no movement.
I've spent the last couple hours trying to figure out (and doing my own research) what I have done or didn't do to get to this point. I'd be willing to bet I am just going about the entire process incorrectly and I'm simple overlooking a basic facet of the program.
Any insight to fix my ignorance is greatly appreciated.
(P.S. Hell, I don't even know if I am using the correct terminology so for all I know I am confusing every person who has taken the time to look at my question. If I am using incorrect terminology please correct me to avoid future hang ups. Thank you.)Ned! This totally worked! Thank you! I knew there was a tiny piece of this whole thing that was preventing me from making everything work. Unfortunately as my luck would have it, although I have the movieclip working the spritesheet converter I'm using now no longer recognizes the movie clip. The converter says there are 7 frames in the animation, but doesn't display any working sprites. Just a blank sheet. Frustrating to say the least.
I'm just going to throw everything out on the table here:
This is the video tutorial i'm using to convert my animation into a spritesheet. I've done the steps exactly as directly up until the point I actually click "Begin Conversion." When begin conversion is selected, it shows the movieclip exists on the bottom left underneath "list of movieclips" but doesn't actually show any individual sprites.
Here's the simple sprite converter I am using.
The irony of this whole situation is that you have successfully helped me make a working movieclip (which was the important piece), but the converter no longer recognizes it. Whereas before, it would at least show the image on the 1 frame of animation it had.
If you wanted to to take a stab at it and see if you can successfully get it to work I'd be appreciative. If not, I totally understand as you have already been incredibly helpful and have my eternal gratitude for getting me this far. These animation programs can be quite overwhelming when they so vastly differ from one another. Don't even get me started no Anime' Studio Pro. -
How to convert .doc file into .rtf file in Java?
Hello All,
I want to convert doc file into rtf format in java and for the same i am not getting any help so pls suggest some solution for that.
Thanks and Regards
only1VinayMS-Word formats (DOC) are notorious for not being standardized from one version to another, so what ever you get will be version specific. If you must do the conversion, I suggest you do a MS-Script in Word to do it or one of the .Net languages. As stated the Word format from version to version is not standardized.
-
Converting sql timestamp into a usable java format??
hi there.
does anyone know how to convert an sql timestamp into a usable java format? i have retrieved a timestamp from a mysql table in a jsp script and would like to convert it into the following format:
12:42pm | 08.07.02
as i understand it, i'll need to convert the timestamp into seconds since 1970 and then manipulate it as a calendar object? my first line is working, but i don't know what to do after...
java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
next...?
any help would be much appreciated!!
thanks.please excuse my java sytnax ignorance, but i've tried a bunch of different syntax arrangements and can't figure out how to use the getTime() method. what comes after my first line there?
java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
then something like:
long msec=date.getTime(sqlTimestamp);
but that doesn't seem to work...
thanks for any help! -
Hi..
I am currently working on Internationalization. I have created property files for the textual content and using PropertyResourceBundles. Now I want to use ListResourceBundles. So what I want to know is..
How to convert Property files into Java Objects.. I think Orielly(in their book on Internationalization) has given an utitlity for doing this. But I did not get a chance to look into that. If anyone has come across this same issue, can you please help me and send the code sample on how to do this..
TIA,
CKHi Mlk...
Thanks for all your help and suggestions. I am currently working on a Utility Class that has to convert a properties file into an Object[][].
This will be used in ListResourceBundle.
wtfamidoing<i>[0] = currentKey ;
wtfamidoing<i>[1] = currentValue ;I am getting a compilation error at these lines..(Syntax error)
If you can help me.. I really appreciate that..
TIA,
CK -
New 2 Java with some errors in prog
Hey Guys and Gals im new to java and im working on some simple progs
my brain is currently wrapped around this problem
---------- Java Compiler ----------
Register8.java:81: incompatible types
found : char
required: java.lang.String
return bits.charAt(bitNumber);
^
1 error
Normal Termination
Output completed (3 sec consumed).
=======================CODE=======================
public String getBit(int bitNumber)
return bits.charAt(bitNumber);
this is the calling stuff
public class Driver
public static void main(String[] args)
Register8 Binary1 = new Register8();
System.out.println(Binary1.getBit(3));Hey there liddle buddy,
How did you define 'bits'
Thang yer very much yer really wonderful
*** ELVIS: He's the MAN ***
This answer was supplied coutesy of : -
Elvis Presley: Programming Consultants inc.
contact: [email protected]
Thang yer very much -
Convert Oracle Forms into Java (swing & JSP's)
Dear All,
We are currently in the process of evaluating our upgrade of system, which is using forms 4.5. One of the options we are considering at this stage is converting all forms into Java program. I am currently doing some pilot work on this project. I am using FormsWizard, a product of InformatikAtelier Gmbh, along with Forms 6i and Jdeveloper 9i. Has any one done this before in this group? Your assistance is much appreciated.
Regards
Michael Sesuraj.
Oracle 8i Certified Database Administrator
Sun Certified Java 2 ProgrammerGrant, Thanks for that mail. It was very useful article. The article has lots of brilliant points consider. I may have to discuss with our System Architect. With my experience in both forms and Java, it is hard to justify the business benefit out of this conversion. We are a strong Oracle house and have no intention of moving towards J2EE at this stage.. Thanks once again.
Michael Sesuraj
Oracle 8i Certified Database Administrator
Sun Certified Java 2 Programmer -
Hi iam new to java can u tell me how to convert from hashmap to string
how to convert from hashmap to string
Hi,
This is not pure Java forum. Its more on JDBC and data connectivity to Orcle db from Java API.
This link may answer your question:
http://stackoverflow.com/questions/960807/hashmapkey-string-value-arraylist-returns-an-object-instead-of-arraylist
Twinkle -
How to convert this Servlet into JSP
I am trying to convert this Servlet into JSP page.
How do I go about doing this?
Thanks.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.text.*;
/** Shows all items currently in ShoppingCart. Clients
* have their own session that keeps track of which
* ShoppingCart is theirs. If this is their first visit
* to the order page, a new shopping cart is created.
* Usually, people come to this page by way of a page
* showing catalog entries, so this page adds an additional
* item to the shopping cart. But users can also
* bookmark this page, access it from their history list,
* or be sent back to it by clicking on the "Update Order"
* button after changing the number of items ordered.
* <P>
* Taken from Core Servlets and JavaServer Pages 2nd Edition
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2003 Marty Hall; may be freely used or adapted.
public class OrderPage extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
ShoppingCart cart;
synchronized(session) {
cart = (ShoppingCart)session.getAttribute("shoppingCart");
// New visitors get a fresh shopping cart.
// Previous visitors keep using their existing cart.
if (cart == null) {
cart = new ShoppingCart();
session.setAttribute("shoppingCart", cart);
String itemID = request.getParameter("itemID");
if (itemID != null) {
String numItemsString =
request.getParameter("numItems");
if (numItemsString == null) {
// If request specified an ID but no number,
// then customers came here via an "Add Item to Cart"
// button on a catalog page.
cart.addItem(itemID);
} else {
// If request specified an ID and number, then
// customers came here via an "Update Order" button
// after changing the number of items in order.
// Note that specifying a number of 0 results
// in item being deleted from cart.
int numItems;
try {
numItems = Integer.parseInt(numItemsString);
} catch(NumberFormatException nfe) {
numItems = 1;
cart.setNumOrdered(itemID, numItems);
// Whether or not the customer changed the order, show
// order status.
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Status of Your Order";
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>");
synchronized(session) {
List itemsOrdered = cart.getItemsOrdered();
if (itemsOrdered.size() == 0) {
out.println("<H2><I>No items in your cart...</I></H2>");
} else {
// If there is at least one item in cart, show table
// of items ordered.
out.println
("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
"<TR BGCOLOR=\"#FFAD00\">\n" +
" <TH>Item ID<TH>Description\n" +
" <TH>Unit Cost<TH>Number<TH>Total Cost");
ItemOrder order;
// Rounds to two decimal places, inserts dollar
// sign (or other currency symbol), etc., as
// appropriate in current Locale.
NumberFormat formatter =
NumberFormat.getCurrencyInstance();
// For each entry in shopping cart, make
// table row showing ID, description, per-item
// cost, number ordered, and total cost.
// Put number ordered in textfield that user
// can change, with "Update Order" button next
// to it, which resubmits to this same page
// but specifying a different number of items.
for(int i=0; i<itemsOrdered.size(); i++) {
order = (ItemOrder)itemsOrdered.get(i);
out.println
("<TR>\n" +
" <TD>" + order.getItemID() + "\n" +
" <TD>" + order.getShortDescription() + "\n" +
" <TD>" +
formatter.format(order.getUnitCost()) + "\n" +
" <TD>" +
"<FORM>\n" + // Submit to current URL
"<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\"\n" +
" VALUE=\"" + order.getItemID() + "\">\n" +
"<INPUT TYPE=\"TEXT\" NAME=\"numItems\"\n" +
" SIZE=3 VALUE=\"" +
order.getNumItems() + "\">\n" +
"<SMALL>\n" +
"<INPUT TYPE=\"SUBMIT\"\n "+
" VALUE=\"Update Order\">\n" +
"</SMALL>\n" +
"</FORM>\n" +
" <TD>" +
formatter.format(order.getTotalCost()));
String checkoutURL =
response.encodeURL("../Checkout.html");
// "Proceed to Checkout" button below table
out.println
("</TABLE>\n" +
"<FORM ACTION=\"" + checkoutURL + "\">\n" +
"<BIG><CENTER>\n" +
"<INPUT TYPE=\"SUBMIT\"\n" +
" VALUE=\"Proceed to Checkout\">\n" +
"</CENTER></BIG></FORM>");
out.println("</BODY></HTML>");
}Sorry.
actually this is my coding on the bottom.
Pleease disregard my previous coding. I got the different one.
My first approach is using <% %> around the whole doGet method such as:
<%
String[] ids = { "hall001", "hall002" };
setItems(ids);
setTitle("All-Time Best Computer Books");
out.println("<HR>\n</BODY></HTML>");
%>
I am not sure how to break between code between
return;
and
response.setContentType("text/html");
Here is my coding:
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
String[] ids = { "hall001", "hall002" };
setItems(ids);
setTitle("All-Time Best Computer Books");
if (items == null) {
response.sendError(response.SC_NOT_FOUND,
"Missing Items.");
return;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>");
CatalogItem item;
for(int i=0; i<items.length; i++) {
out.println("<HR>");
item = items;
if (item == null) {
out.println("<FONT COLOR=\"RED\">" +
"Unknown item ID " + itemIDs[i] +
"</FONT>");
} else {
out.println();
String formURL =
"/servlet/coreservlets.OrderPage";
formURL = response.encodeURL(formURL);
out.println
("<FORM ACTION=\"" + formURL + "\">\n" +
"<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\" " +
" VALUE=\"" + item.getItemID() + "\">\n" +
"<H2>" + item.getShortDescription() +
" ($" + item.getCost() + ")</H2>\n" +
item.getLongDescription() + "\n" +
"<P>\n<CENTER>\n" +
"<INPUT TYPE=\"SUBMIT\" " +
"VALUE=\"Add to Shopping Cart\">\n" +
"</CENTER>\n<P>\n</FORM>");
out.println("<HR>\n</BODY></HTML>");
Maybe you are looking for
-
Which Processor is Better?
Im debating between getting a fully upgraded MacBook Pro Retina 13" or 15" with no upgrades. Which of these is better for general use, light gaming, and a little video editing? 13" - 3.0GHz Dual-core Intel Core i7, Turbo Boost up to 3.5GHz or 15" -
-
HT5163 Does the iphone 4 (Verizon) have a way to remove sim?
I was giving my old phone to a friend. I reset it but was going to remove my sim when I discovered it did not have a sime slot like my old ATT iphone. Are they built into the Verizon phone?
-
Hi, I would like to know that if we have our database in FORCE LOGGING mode with standby databases,could cause some kind of conflicts if we create then objects with the NOLOGGING clause?? , something like corrupt the standby databases?? The objects t
-
Get the connected users count from sql server using powershell
Hi, I am working on SharePoint 2013,I am having SQL server 2012. I want to get the Connected Users count from sql server using power shell. Can any one please let me know how to implement. Thanks in advance. Regards, Phani Kumar R
-
Do not want component consumption in Production order confirmation.
How to create production order so that NO component consumption takes place during confirmation of the order. A list of equipment comes from Delivery created by Project System. These equipments have to be assembled into a KIT.Then some of the equipm