Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with request.getParameter();  RSS feed

 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hallo all,
let me explain my problem, well i have 3 jsp pages.
1 a.jsp --- authentication page
2 b.jsp -- doc.jsp which has 2 frames , in frame 1 i have Menu.jsp and frame 2 i have List.jsp
Menu.jsp --- is frame where i give some parameters for some search and i see the results in List.jsp
: till now everything works fine (i mean after authentication page im able to go for a search with my parameters and then see the results on the List.jsp)
MY REQUIREMENTS:
well i want to give my search parametes as a link for example ( htttp:0wn/doc.jsp/clientnum=100&datebirth=190276) and i want to send this as a link to the end user , when my user clicks this then he should be automatically taken to authentication page and on sucessful authentication he should be able to see the results with the parameters which i have specified( the pains of entering values in Menu.jsp is avoided) and im supplying the parameters directly on the browsers address bar!!!
MY problem
my page List.jsp(in 2nd frame of Doc.jsp) is not able to get the parameters from Doc.jsp (main jsp which comprises of two frames Menu.jsp + List.jsp)..
please tell me ur views to find a solution to this.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


( htttp:0wn/doc.jsp/clientnum=100&datebirth=190276)

Shouldn't this be of the form:
htttp://0wn/doc.jsp?clientnum=100&datebirth=190276


MY problem
my page List.jsp(in 2nd frame of Doc.jsp) is not able to get the parameters from Doc.jsp (main jsp which comprises of two frames Menu.jsp + List.jsp)..

It depends a lot on how you have implemented the Search component. With the info you have given, to solve this I think
you can pass the parameters as two ArrayLists (or Arrays or Vectors why?) containing the Name Value pairs. Actually, since the Names wouldn't be dynamic you can have ONE ArrayList of the values in a pre-determined order. Instantiate the ArrayList on the request scope and generate the URL's in the results page dynamically. Thus the links will have the correct name-value parameters.
We could help you more if you post code or something - not soliciting just that it will give us a better understanding of the problem.
Good Luck.
- satya
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with reference to my earlier post , im including the source code of my 3 jsp files.
Dokumentensuche1.jsp --- source code
this Dokumentensuche1.jsp is the main jsp page which has two frames each frame has jsp pages viz. Menu2.jsp and Trefferliste.jsp , im trying to get the parameters (which im not able to ..) and set them and then getting the attributes in Trefferlist.jsp (which is inside a frame of Dokumentsuche1.jsp),
im not successful please help
******
on my browsers address bar im typing like this
http wmsun/Dokumentensuche1.jsp"> unde=200&op=>
*********************************************************
<%@ include file="user_control.jsp" %><! -- login page-->
<html>
<head>
<title><%=cfg.getValue("title")%></title>
<%@ page import="java.util.*" %>
<jsp:useBean id="IniFile" scope="application" class="imarecherche.IniFile" />
<jsp:setProperty name="IniFile" property="folder" />

<jsp:useBean id="doXml" scope="session" class="imarecherche.doXml" />
</head>
<frameset rows="200,*" framespacing="0" border="0" frameborder="0" marginwidth="2" marginheight="2" >
<frame src="Menue2.jsp" name="Menue" marginwidth="5" marginheight="3" scrolling="no">
<!--
<%

Enumeration paramNames = request.getParameterNames();
System.out.println("param : " + paramNames);
while (paramNames.hasMoreElements())
{
String paramName =(String)paramNames.nextElement();
System.out.println("param: " + paramNames);
}
// this is returning a null value
String urlAddress = "Trefferliste.jsp";
if(IniFile.ReadIniFile(cfg.getValue("ini_file")))
{
System.out.println("gelesen++++++++++++++");
}


String kunde = request.getParameter("kunde");
// this returns a null value
System.out.println("kunde: " + kunde);
if (kunde != null)
{
String op = request.getParameter("op");
if (op != null)
{
op = "=";

}
// String folder = request.getParameter("folder");
urlAddress = "Trefferliste.jsp?searching=true&kunde=0&op=>";
}

System.out.println(urlAddress);

%>
<%
System.out.println("DSP-----------------------------------------------------------------");
System.out.println("DSP*****************************************************************");
// im trying different ways just to see my parameters
Enumeration paramNames2 = request.getParameterNames();
System.out.println(request.getQueryString());
System.out.println(request.getMethod());
while (paramNames2.hasMoreElements())
{
String paramName =(String)paramNames2.nextElement();
System.out.println("param: " + paramName);
}
System.out.println("DSP%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println("DSP*****************************************************************");


System.out.println("DS*****************************************************************");
System.out.println(kunde + "-" + op);
}
%>
String kunde = request.getParameter("kunde");
<frame src="<%=urlAddress%>" name="Trefferliste" marginwidth="5" marginheight="3" scrolling="auto">
</frameset>
<!--
<body bgcolor=#FFFFFF text=#000000 link=#AA5522 vlink=#772200 alink=#000000>
</body>
-->
</html>

is there any problem in my code!!!
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well in my url which i type on my browser is like this- i left the k so its
http wmsun/Dokumentensuche1.jsp">kunde=200&op=>

[This message has been edited by Madhav Lakkapragada (edited October 30, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!