• Post Reply 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

drop down list for servlet form

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone help me with this code.
I want to put a dropdown list in this servlet form, please I need help in rewriting this code. (On the MDA Name i need a dropdown list)

import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InboundCaseLog extends HttpServlet
{protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String mess1 = req.getParameter("message");
out.println("<HTML><HEAD><TITLE>Inbound Case Log</TITLE></HEAD>"+'\n'+
"<BODY BGCOLOR='lightgreen'>"+'\n'+
"<P><H2 ALIGN=CENTER>NEW INBOUND CASE LOG ENTERING </H2");
out.println("<html><head><title>Inbound Case Log</title></head>");
out.println("<body bgcolor = 'lightblue'>");
out.println("<form method = \"post\" action = \"http://localhost:8080/servlet/Relay\">");
out.println("ReferralID: <INPUT type = \"TEXT\" size = 20 name = \"RefID\"><P>");
out.println("MDA Name: <INPUT type = \"TEXT\" size = 20 name = \"MdaName\"><P>");
out.println("MDA Contact Name: <INPUT type = \"TEXT\" size = 20 name = \"MdaC\"><P>");
out.println("Contact TelNo: <INPUT type = \"TEXT\" size = 20 name = \"Tel\"><P>");
out.println("Contact Position: <INPUT type = \"TEXT\" size = 20 name = \"Position\"><P>");
out.println("Date Recieved: <INPUT type = \"TEXT\" size = 20 name = \"DateRec\"><P>");
out.println("Project Name: <INPUT type = \"TEXT\" size = 20 name = \"PName\"><P>");
out.println("<INPUT type = \"submit\" value = \" Send Details\"<P>");
out.println("<INPUT type = \"hidden\" name = \"choice\" value = \"CaseLogEntry\"><P>");
out.println("</form></body></html>");
}
}
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest the following steps:
1. Create a static HTML page that corretly displays the list.
2. Use that as a guide to creating the page with servlet output statements
3. If it doesnt work, use the browser view-source and compare what your servlet is writing with the static page.

Bill
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Harrison I, please check your private messages.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any reason that you must do this in a servlet? Generating HTML markup in Java strings is a pain as you have discovered. This is a much better task for a JSP.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
out.println("MDA Contact Name: <select name = \"MDA\">");
out.println("<option value ='value1'>Value 1 </option>");
out.println("<option value ='value2'>Value 2</option>");
out.println("<option value ='value3'>Value 3</option>");
out.println("</select> <P>" );
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic