forms in servlets

hello

is it possible to create a form within a servlet I DO NOT want to create a separate html file just for the form....

so for example:

<FORM ACTION="login" METHOD="POST">

<INPUT TYPE=TEXT NAME="userID" SIZE=15>

<INPUT TYPE=SUBMIT VALUE="Login">

login is a servlet page. what i want is that once the user presses the submit button a table of results will come up on the same page.

it should not transfer the user to a different page. so i guess the table of results will already be there but hidden and once the user presses submit it will appear. does anyone know hw to do this or provide some guide code?

[675 byte] By [moh_1_and_onlya] at [2007-11-26 21:38:50]
# 1

If I'm understanding your question correctly, something like the following should do the trick:

out.println("<FORM ACTION="login" METHOD="POST">");

out.println("<INPUT TYPE=TEXT NAME="userID" SIZE=15>");

out.println("<INPUT TYPE=SUBMIT VALUE="Login">");

Though you might experience some problems with the quotes, so just use breaks if needed.

Nidhuggura at 2007-7-10 3:22:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

One other part to get hold of is the "content length" of the

request, if that is "less than the total quantity of characters

field-names and form name and their = and &

(ampersand) signs then make the if else in the service()

print the form or if their appears to be enough submitted

contents then run it through the servlet process.

ACTION="login" should be alike

ACTION="http://somedomain/somejsp-servlet-app/Processorservlet"

nicephotoga at 2007-7-10 3:22:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...