wood burning stoves*
The moose likes JSP and the fly likes simple code help urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "simple code help urgent" Watch "simple code help urgent" New topic
Author

simple code help urgent

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
code of my doc.jsp
--------------------------------------------------
<%
session.setAttribute( "client" , request.getParameter("cly"));
session.setAttribute( "operate" , request.getParameter("oper"));
%>
<html>
<frame src = "Menu.jsp" >
<frame src = "List.jsp>
<html>
_____________________________________________________________
code of Menu.jsp
<h2> hi im empty frame
_____________________________________________________________
code of List.jsp
<% System.out.println(session.getAttribute("client"));%>
<% System.out.println(session.getAttribute("operate"));%>
</html>
------------------ the System.out(---) mentioned in List.jsp returns a null and does not return me the value what i specify on the browsers address bar for eg http wn/doc.jsp/client=10&operate=20
can anyone explain why im getting null and also a way to get the correct value !!!


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Nair Anoop
Ranch Hand

Joined: May 09, 2001
Posts: 68
Hi,
Shouldn't this
wn/doc.jsp/client=10&operate=20
be
wn/doc.jsp?cly=10&oper=20
~ Anoop

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
ya sure im sorry i left over that ? , i have done it in same way as u said but still not working!!!
ziqiang wu
Greenhorn

Joined: Jun 18, 2001
Posts: 25
1. session.setAttribute( "client" , request.getParameter("cly"));
should be
session.setAttribute( "client" , request.getParameter("client"));
2. session.setAttribute( "operate" , request.getParameter("oper")); should be
session.setAttribute( "operate" , request.getParameter("operate"));
according to wn/doc.jsp?client=10&operate=20
Moreover, I used to get value from session by session.getValue("key_name"), not by session.getAttribute("key_name").
ziqiang wu
Greenhorn

Joined: Jun 18, 2001
Posts: 25
Moreover, I think a link, for example <a href="doc.jsp?client=aa&operate=bb>***</a>, can not pass your parameters, you have to use a form to pass them, for example, <form action="doc.jsp?client=aa&operate=bb" method="post" name="f1">.
if I am wrong, please let me know. thanks.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
You are wrong The parameter syntax used is correct for a GET request such as the one generated by clicking a link.
- Peter
ruijin yang
Ranch Hand

Joined: Apr 29, 2001
Posts: 96
Hi vivek,
You lose some lines.I tested it Ok:
<frameset rows="25%,75%">
<frame src = "Menu.jsp">
<frame src= "List.jsp">
</frameset>


SUN Certified Business Component Developer Java EE Platform 5 (2008)<br />SUN Certified Developer for Java Web Services (2007)<br />IBM WebSphere Portal V5.1 Application Development (2006)<br />SUN Certified Web Component Developer (2001)<br />SUN Certified Java 2 Programmer (2001)
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
no nothing works i will now give my full code
<% include file = "user_control.jsp" %>
>html>
<head>
<title><%=cfg.getValue("title")%> </title>
<jsp: useBean id = "IniFile" scope = "application" class = "imar.IniFile"/>
<jsp: useBean id = "doXml" scope ="session" class="imar.doXml"/>
</head>
<frameset rows = "200,*" framespacing="0" border="0" frameborder="0" >
<frame src = "Menu.jsp" name = "Menue" marginwidth = "3" >
<%
String kunde = request.getParameter("kunde");
String op = request.getParameter("op");
System.out.println(kunde + "the values" + op);
%>
<frame src = "Trefferliste.jsp" name = "Trefferliste" marginwidth="5" >
</frameset>
<body bgcolor = #FFFFF >
</body>
</html>
Ernest Lee
Ranch Hand

Joined: Aug 20, 2001
Posts: 145
hi, try this:
pass the sessionID to ur frame using encodeURL()...
<frame src=<%=encodeURL(menu.jsp)%>
<frame src=<%=encodeURL(main.jsp)%>
as the problem may be caused by cookie setting....
sorry, i am not a expert-JSP programmer...syntax maybe wrong.
ziqiang wu
Greenhorn

Joined: Jun 18, 2001
Posts: 25
hi Peter please tell me where the syntax is wrong? just provide an example. Thanks
Wu
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
The syntax isn't wrong, the syntax is right, that was the point - a link such as the one you mentioned works fine to pass parameters.
- Peter
 
Don't get me started about those stupid light bulbs.
 
subject: simple code help urgent