Hi Tyla,
u could hv used action attribute of Form tag of html but if u really want
to reach to the IM servlet through reference then use encodeURL method
instead of directly concatinating the strings.
Manish Singh
[EMAIL PROTECTED]
GlobalId: 14150000375 voicemail/fax
--------------- Original Message ---------------
From:[EMAIL PROTECTED]
To:[EMAIL PROTECTED]
CC:
Date:Tue, 29 Aug 2000 11:29:11 -0700
Subject:Why Do I kept Getting Null values?
I have 2 java servlets: One is called CreateSTR and the other is called IM.
In IM, I expected to be able to
use getParameter to get the selected value of "prodcode" and "priority" from
CreateSTR, but I always get a null value.
In CreateSTR, I called IM everytime I select a prodcode value. Could you
please see my codes below and help
me find out what it is that I am doing wrong? I have no idea how to fix the
problem as I am new at learning Java Servlet.
Any help would be greatly appreciated. Thanks.
Tyla
==========================================CreateSTR.java====================
=================
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
public class CreateSTR extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
response.setHeader("Pragma","cache");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
try {
out.print("<html>");
out.print("<form>");
out.print("<table border =0 align left width=80%
cellborder=100>");
out.print("<tr>");
out.print("<td><b>Product Code</b></td>");
out.print("<td><b>Release#</b></td>");
out.print("<td><b>Subsystem </b></td>");
out.print("<td><b>Platform</b></td>");
out.print("</tr>");
rs = stmt.executeQuery("SELECT * from scars.tc_prodcode where
status="+"'"+"active"+"'" +"order by full_name");
out.print("<td>");
out.print("<select name="+"prodcode size=1 "+"onChange= "
+"Sel_Prod(this)>");
out.print("<option value= " +">" +"select a product code");
while(rs.next()){
int aa = 0;
int b = 0;
pcabbr[aa] = rs.getString("pcabbr");
full_name[b] = rs.getString("full_name");
out.print("<option value= " +pcabbr[aa]+">" +full_name[b]);
}//end rs.next
out.print("</select>");
out.print("</td>");
out.print("<table border =0 align left width=80%
cellborder=100>");
out.print("<tr>");
out.print("<td><b>Customer/System</b></td>");
out.print("<td><b>Priority</b></td>");
out.print("<td><b>Urgency</b></td>");
out.print("</tr>");
out.print("<select name="+"priority
"+"onchange=this.options[this.selectedIndex].value"+ "size="+"1>");
out.print("<option value= " +">" +"select a priority");
out.print("<option value= Critical> Critical</option>");
out.print("<option value= Serious> Serious</option>");
out.print("<option value= Annoyance> Annoyance</option>");
out.print("</select>");
out.print("</td>");
out.print("<script language=\"JavaScript\">");
out.print("function Sel_Prod(s) { ");
out.print("userInput = new String();");
out.print("userInput = s.options[s.selectedIndex].value;");
rs = stmt.executeQuery("SELECT unique releaseno from
scars.tc_releases where status='active'");
out.print("location.href="+"'"+"http://oldbob.eng.filenet.com:8080/servlet/I
M prodcode="+"'"+"+"+"userInput"+"+'&priority="+priority+"'");
out.print("}");
out.print("</script>");
out.print("</form>");
out.print("</html>");
}//try
=================================IM.java====================================
=====
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
import java.awt.*;
public class IM extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
response.setHeader("Pragma","cache");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String pcabbr = request.getParameter("prodcode");
String priority = request.getParameter("priority");
System.out.println("prodcode is: " +prodcode);
System.out.println("priority is: " +priority);
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
________________________________
eTouch.com Linking People Everywhere!
Get FREE Voicemail/Fax/Email at http://www.etouch.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html