Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Re: calling a JSP from Javascript


Message #1 by "Fahad Khan" <fahad_djs@h...> on Mon, 03 Mar 2003 11:22:57 +0500
 
Hi SEAK, Teng-Fong,
I am sorry for late response, The summary of the thread is that "Nazneen "has two frames in one of them she has nodes and in the
other she has to browse a document. She wanted to pass some values to the document that has to be browsed in the other frame. She
asked her question that she has to attach some parameters in querystring and browse the URL along with these parameters in other
frame. These values are captured on the clicking event of nodes and in the same event she attaches the captured values to
querystring and next browse the document in other frame. I told her the general way that how to attach both the hard-coded values
and the variables in a querystring though it is quite easy to understand and achieve such a simple task.
top.frame2.location.href="some.jsp?constantValue=this_value_is_never_changed&variableValue="+variable;
Both kinds of parameter are demonstrated above and could be repeated in a single querystring as many number of times as needed.
Fahad.....................................




>From: "SEAK, Teng-Fong" 
>Reply-To: "javascript" 
>To: "javascript" 
>Subject: [javascript] Re: calling a JSP from Javascript 
>Date: Wed, 26 Feb 2003 16:42:36 +0100 
> 
> Could you resume the problem (and maybe open a new thread) and post 
>it ? I'm lost in the discussion :) Posting ome code might be also a good 
>idea to let us have a global view. 
> 
> > -----Message d'origine----- 
> > De : Fahad Khan [mailto:fahad_djs@h...] 
> > Envoyé : mercredi 26 février 2003 16:28 
> > Ã? : javascript 
> > Objet : [javascript] Re: calling a JSP from Javascript 
> > 
> > 
> > 
> > Hi Teng-Fong, 
> > Thank you, But in the code 
> > (somePage.jsp?constantParameter=constantValue&databaseParamete 
> > r=" + varHavingDatabaseValue) , I just tried to differntiate 
> > between the values that we have in a variable and those we 
> > hard-code them as they are constant (not kept in a variable 
> > as not neccessary at some places). 
> > constantParameter=constantValue, demonstrates values that are 
> > hard-coded while 
> > "&databaseParameter="+varHavingDatabaseValue, is the variable 
> > having value that may vary irrespective to its source (could 
> > be an array, database etc.). 
> > Well Yes "encoding" advice is appreciated. :) 
> > Fahad, 
> > .................... 
> > 
> > 
> > 
> > 
> > >From: "SEAK, Teng-Fong" 
> > >Reply-To: "javascript" 
> > >To: "javascript" 
> > >Subject: [javascript] Re: calling a JSP from Javascript 
> > >Date: Wed, 26 Feb 2003 16:11:45 +0100 
> > > 
> > >The crucial instruction is the following : 
> > > 
> > >top.frame2.location.href = 
> > >"somePage.jsp?constantParameter=constantValue&databaseParameter=" + 
> > >varHavingDatabaseValue 
> > > 
> > >Is constantValue a variable name ? Is yes, it should be like this : 
> > > 
> > >top.frame2.location.href = 
> > >"somePage.jsp?constantParameter=" + constantValue + 
> > "&databaseParameter=" + 
> > >varHavingDatabaseValue 
> > > 
> > >As a word of warning, it's better use encodeURIComponent (or 
> > escape if you 
> > >like, but this function is deprecated) to encode your query 
> > string to avoid 
> > >invalid characters appearing in it. 
> > > 
> > > > -----Message d'origine----- 
> > > > De : nazneen shaikh [mailto:shaikhnazneens@y...] 
> > > > Envoy�© : mardi 25 f�©vrier 2003 11:02 
> > > > Ã?â?¬ : javascript 
> > > > Objet : [javascript] Re: calling a JSP from Javascript 
> > > > 
> > > > 
> > > > Hi Fahad, 
> > > > And Thanks a lot. 
> > > > I was trying the same syntax but there was a problem 
> > > > in the quotes that I had given to form the string for 
> > > > href. 
> > > > Regards 
> > > > Nazneen 
> > > > --- Fahad Khan wrote: 
> > > > > 
> > > > > Hello, 
> > > > > As you said you have an application, I� assume, you 
> > > > > are working within a browser. This is also not quite 
> > > > > clear that how a page can be thrown? I assume, you 
> > > > > are browsing a page in another frame. 
> > > > > The situation as I see is that you have two frames. 
> > > > > One has a 'tree' and another has nothing by default. 
> > > > > When you click any node, a page is browsed in 
> > > > > another frame. you do it by doing this: 
> > > > > top.frame2.location.href="somePage.jsp" 
> > > > > If you are doing� same thing on� node's clicking 
> > > > > event, you could pass the parameters in a 
> > > > > querystring from the same place as : 
> > > > > 
> > > > top.frame2.location.href="somePage.jsp?constantParameter=const 
> > > > antValue&databaseParameter="+varHavingDatabaseValue 
> > > > > In above example, parameters are passed from 
> > > > > frame� having nodes, to the frame which has to browse 
> > > > > the given page. Now in "somePage.jsp" get the 
> > > > > parameters from the querystring. that needs bit of 
> > > > > jsp skills. 
> > > > > Another method to pass parameters is a post method. 
> > > > > But first let me know that are u looking for the 
> > > > > same thing. 
> > > > > �  
> > > > > Fahad Khan 
> > 
> 
>--- 
Add photos to your e-mail with MSN 8. Get 2 months FREE*.

  Return to Index