Passing User selection to other pages

[nobr]Hi all,

I want to develop a page like a below one.This is related to betting.

so when user select one race from the race list and press bet, it goes to betting page.

if user press the "place bet" on the betting page, the details of the punter will be added to the bet table in the DB. thats all i want but i'm familiar with servlet only. so i'm developing with servlet.

--

CheapBet Races:

London Met gold Cup

held each year in london this race tests horses to their limits over rough ground with many hurdles

linusLinkus 1 -Bet

BrainR 1 -Bet

figget 2 -Bet

the hkci rocket horse 10 -Bet

race

Happy Valley special

sponsered by HKCI this premium horse race is held weekly

wanchai wonder 1 -Bet

kowloon kwicky 3 -Bet

central express 20 -Bet

valley vortex 10 -Bet

race

This is my coding bit for the above page. upto now i'm just getting the race lists from the db and displaying in a page. I have no idea in how to go further to do other stuff. please give ur comment with some implementation for this to guide me. thanks

--

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

publicclass raceextends HttpServlet

{

Connection connection;

publicvoid init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

publicvoid doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException

{

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1><br>");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("<br>");

out.println(rs.getString("description"));

out.println("<br>");

rs.getString("id");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<br>");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<br>");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<br>");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?\">");

out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

--

betting page

-

CheapBet Place your Bet

Enter your amount: textbox

place bet.

Go back to main page.[/nobr]

[5704 byte] By [S-kugana] at [2007-11-27 1:35:51]
# 1

Your Servlet A generate a HTML page which contains a form used to submit some data inputted by user.

By setting the form action parameter, you can submit those data to Servlet B.

request.getParameter("name") to retrieve the input in the form

If you want to forward those data from Servlet B to Servlet C, you can have a look on requestDispatcher and forward the request and response

If you want to add some extra things, you can use request.setAttirbute or session.setAttribute if you want to last for a session.

rym82a at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]Hi,

I've already tried the passing parameters via html form.The following is my coding. In this i'm using HTML POST but that POST didn't work when I included in servlet file. I need to have that html file seperately to work out that. I can use HTML Get method in servlet, which can be included in servlet but HTML GET did not allow us o send both handwired parameters and parameters from a form at the same time. this is the limitation in this.

so my main problem is , I don't know how to use HTML POST with servlet...thanks..

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

public class race extends HttpServlet

{

Connection connection;

public void init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://url","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1><br>");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("<br>");

out.println(rs.getString("description"));

out.println("<br>");

rs.getString("id");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+"\">");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h2&race="+rs.getString("id")+"\">");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h3&race="+rs.getString("id")+\">");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h4&race="+rs.getString("id")+\">");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

//out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+\">");

//out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

//out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=account&email=1\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

[/nobr]

S-kugana at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
For your class race (extends HttpServlet)You have to implement doGet and doPost to support GET and POST methods accordingly.
rym82a at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi,Can u demonstrate me with a coding please?It would be grateful for me, if u do it, cze I've got stuck with this for long time.thanks
S-kugana at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Reading the Java EE tutorial might be helpful: http://java.sun.com/javaee/5/docs/tutorial/doc/Servlets starts at chapter 3.
BalusCa at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

> For your class race (extends HttpServlet)

> You have to implement doGet and doPost to support GET

> and POST methods accordingly.

public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

// GET method

}

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

// POST method

}

rym82a at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
I've already tried this. but not working indeed.It says- HTTP Status 405 - HTTP method POST is not supported by this URL. but I do implemented POST method on my coding.
S-kugana at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

> I've already tried this. but not working indeed.

>

> It says- HTTP Status 405 - HTTP method POST is not

> supported by this URL. but I do implemented POST

> method on my coding.

From the code you have attached, I don't see you have implement the POST method for your Servlet. (or it just a snippet ?)

Attach the full code (if it is not really long)

rym82a at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

[nobr]Hi rym,

The following is my coding.

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

public class race extends HttpServlet

{

Connection connection;

public void init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://url","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

//public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

//{

// GET method if i implement this without overiding the doGet I just getting the blank page

//}

public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

doPost(request,response);

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1><br>");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("<br>");

out.println(rs.getString("description"));

out.println("<br>");

rs.getString("id");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+"\">");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h2&race="+rs.getString("id")+"\">");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h3&race="+rs.getString("id")+\">");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h4&race="+rs.getString("id")+\">");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

//out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+\">");

//out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

//out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"url?action=account&email=1\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

It's working for doGet method, but it''s not passing the parameters when user sleect to bet one race, so I've tried on doPost (cze doPost can pass the parameters) but I'm getting the error as "- HTTP Status 405 - HTTP method POST is not supported by this URL.".

As i mentioned earlier if i want to use doPost, It has to be in a seperate

html file. but if i do that i can't pass the parameters.

I hope u get me.

thanks[/nobr]

S-kugana at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

> From the code you have attached, I don't see you have

> implement the POST method for your Servlet. (or it

> just a snippet ?)

>

> Attach the full code (if it is not really long)

As I have told you, you have not implement the POST method which is doPost.

Your doGet method called doPost doesn't mean you have implement doPost.

You have to implement it like your doGet method.

rym82a at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11

[nobr]Hi,

This is my implementation for doPost. If I'm not correct this time. please

put idea in coding. For this implementation I'm getting the following Error-HTTP Status 405 - HTTP method GET is not supported by this URL. But I'm not using the GET method anywhere else here.

So I don't know what's wrong in this coding.

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

public class race extends HttpServlet

{

Connection connection;

public void init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://url","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1><br>");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("<br>");

out.println(rs.getString("description"));

out.println("<br>");

rs.getString("id");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+"\">");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h2&race="+rs.getString("id")+"\">");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h3&race="+rs.getString("id")+\">");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h4&race="+rs.getString("id")+\">");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

//out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+\">");

//out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

//out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"url?action=account&email=1\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

[/nobr]

S-kugana at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12

> This is my implementation for doPost. If I'm not

> correct this time. please

> put idea in coding. For this implementation I'm

> getting the following Error-HTTP Status 405 - HTTP

> method GET is not supported by this URL. But I'm not

> using the GET method anywhere else here.

> So I don't know what's wrong in this coding.

This error is goaled towards the end-user. You, as developer, should know it better. You haven't implemented doGet() yet :)

A few more hints: separate business logic from display. Use DTO's. And always gently close connections, statement and resultsets after use. You're leaking resources otherwise.

BalusCa at 2007-7-12 0:44:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13
This time you have not implement the GET method of your Servlet.Why can't you implement both doGet and doPost ?
rym82a at 2007-7-12 0:44:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 14
Hi rym,I don't get u anything this time. because What do i put underneath doGET() method?. I'm just the beginner in this. so please forgive me.Do u mean i need to put the same method in both doPost and doGet?please give some sample coding for doGet?..thanks
S-kugana at 2007-7-12 0:44:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 15

doGet() handles GET requests. Those are simple plain requests invoked by links, eventually supplied with query strings.

doPost() handles POST request. Mainly invoked by forms with method="post".

If you want both to behave the same, then just let them call both the same method.

Pseudocode:doGet(req, res) {

doAction(req, res);

}

doPost(req, res) {

doAction(req, res);

}

doAction(req, res) {

// Implement.

}

Some people just do:doGet(req, res) {

// Implement

}

doPost(req, res) {

doGet(req, res);

}

Which is less elegant tho.

Finally, I highly recommend you to just gently read the Java EE tutorial behind the link I provided here above.

BalusCa at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 16

> Hi rym,

>

> I don't get u anything this time. because What do i

> put underneath doGET() method?. I'm just the beginner

> in this. so please forgive me.

> Do u mean i need to put the same method in both

> doPost and doGet?

>

> please give some sample coding for doGet?..

>

> thanks

see reply #5, #6, #15

AND ALSO your previous post

http://forum.java.sun.com/thread.jspa?threadID=5158015

rym82a at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 17

[nobr]Hi Balus and rym,

I've tried that. but when it's compile it says- invalid method declaration; return type required.

<identifier> expected

doGet(request,response)

This is my amended coding.

[code]

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

public class race extends HttpServlet

{

Connection connection;

public void init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://url","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

doGet(request,response)

{

doAction(request, response);

}

doPost(request,response)

{

doAction(request, response);

}

public void doAction(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1>

");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("

");

out.println(rs.getString("description"));

out.println("

");

rs.getString("id");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+"\">");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("

");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h2&race="+rs.getString("id")+"\">");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("

");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h3&race="+rs.getString("id")+\">");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("

");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h4&race="+rs.getString("id")+\">");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("

");

//out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+\">");

//out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

//out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"url?action=account&email=1\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

[/code

hopu u guys, this time also i'll get the reply and make this coding running.

thanks

(really tired with this)[/nobr]

S-kugana at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 18

See reply #11 of http://forum.java.sun.com/thread.jspa?threadID=5158015

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

doProcess(request,response);

}

public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

doProcess(request,response);

}

public void doProcess(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

// Your implementation of both GET and POST method

}

rym82a at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 19

[nobr]Hi rym,

I've done u as u mentioned. The compiling successfully and when the user select the the particular race and click the bet button the page has to go to betting page. but it's not. it says- HTTP Status 405 - HTTP method POST is not supported by this URL.

But i can see the parameters passing to that page. but that page is not

loading. if i change that HTML POST into GET the betting page is loadidng but i can't see the parameters passing in the url.

This us my coding.

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

public class race extends HttpServlet

{

Connection connection;

public void init()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

//loading a driver

connection = DriverManager.getConnection("jdbc:mysql://url","username","password");

//connecting to a database

}

catch (Exception a)

{

a.printStackTrace();

}

}

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

doProcess(request,response);

}

public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

doProcess(request,response);

}

public void doProcess(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException

{

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println("<HTML>");

out.println("<BODY>");

out.println("<h1> CheapBet Races: </h1><br>");

try

{

Statement statement = connection.createStatement();

ResultSet rs=statement.executeQuery("select * from races;");

while (rs.next())

{

out.println(rs.getString("title"));

out.println("<br>");

out.println(rs.getString("description"));

out.println("<br>");

rs.getString("id");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+"\">");

out.println(rs.getString("h1")+""+rs.getString("odds1"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h2&race="+rs.getString("id")+"\">");

out.println(rs.getString("h2")+""+rs.getString("odds2"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h3&race="+rs.getString("id")+\">");

out.println(rs.getString("h3")+""+rs.getString("odds3"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h4&race="+rs.getString("id")+\">");

out.println(rs.getString("h4")+""+rs.getString("odds4"+""));

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Bet!\">");

out.println("</FORM>");

out.println("<br>");

//out.println("<FORM METHOD=\"POST\" ACTION=\"http://url?action=bet&horse=h1&race="+rs.getString("id")+\">");

//out.print("<INPUT TYPE=\"SUBMIT\" VALUE=\"Race!\">");

//out.println("</FORM>");

}

}

catch (Exception e)

{

out.println("error occured"+e);

e.printStackTrace();

}

out.println("<FORM METHOD=\"POST\" ACTION=\"url?action=account&email=1\">");

out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"View account and bet details\">");

out.println("</FORM>");

out.println("</BODY>");

out.println("</HTML>");

}

}

[/nobr]

S-kugana at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 20
Post your web.xml which config the matching of your URL.From the code you have posted, it would send a request to url.And I wonder if you have an alias URL called url.
rym82a at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 21
> I've tried that. but when it's compile it says-> invalid method declaration; return type required.> > <identifier> expected>doGet(request,response)Dude .. Never heard of pseudocode?
BalusCa at 2007-7-21 20:09:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...