File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

simple code help urgent

 
vivek sivakumar
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !!!
 
Nair Anoop
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Shouldn't this
wn/doc.jsp/client=10&operate=20
be
wn/doc.jsp?cly=10&oper=20
~ Anoop

 
vivek sivakumar
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vivek,
You lose some lines.I tested it Ok:
<frameset rows="25%,75%">
<frame src = "Menu.jsp">
<frame src= "List.jsp">
</frameset>

 
vivek sivakumar
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Peter please tell me where the syntax is wrong? just provide an example. Thanks
Wu
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic