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

taking value w/o submit  RSS feed

 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
was wondering if there was any way that i could navigate from page1 to page2 via a link, but also keeping a text value without submit(maybe by setting it in request or session scope).

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fact that you mention request and session scope makes this not an HTML question, but a JSP one.

Moved to the JSP forum.
[ September 30, 2005: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, whenever you click a link you are submitting a request (a GET in this case).

To get a value from one request to the other you could:

1) pass it as a request parameter on the URL
2) store it in a cookie
3) tack it onto session scope (request scope will not do)
4) store it in a DB
5) store it in a file

and so on.

If the value is transient and only needs to be passed from the first page to the send without having to stay around, option (1) makes the most sense.
[ September 30, 2005: Message edited by: Bear Bibeault ]
 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know I was not clear with my question should read the "how to ask a smart question" again.

Bear, I know i want to set it to the session scope. but i was having problems getting the actual value from the field.
<%
session.setAttribute( "atribName", how would I get the value here);
%>

How would i do that, actually that's why I thought I should I should post the Q in the javascript forum.
[ September 30, 2005: Message edited by: mannu kapoor ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the value coming from?
 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user enters it in a
<input type="text"....>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getParameter("param_name");
 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a question though, how would i make it work if the user changed the value...
like an "onchange"

this is what i do currently:
<%
String pin = request.getParameter("analyst_pin");
session.setAttribute( "analpin", pin);
%>

obviously this will work only once. how would i do it for onchange
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onchange is a Javascript event that takes place on the client machine.

All of your JSP code take place on the server.
Whatever value is sent when the form is submitted is what you will get using request.getParameter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!