This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

passing a value from one page to another  RSS feed

 
Madam deman Leonardo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

First of all, I am happy to join this wonderful forum! thanks alot for your support and effort.

I have two pages page1.jsp and page2.jsp and I want to pass a value from page1.jsp to page2.jsp
For example :
Page1.jsp contains the following:
----------------------------------
<%
String j="";
%>
<a href="page2.jsp?j="+j > link </a>
------------------------------------
However this does not work at all

BTW: j is a dynamic variable it is changed every time I entered the page because of that I could not add it as astring to the href

thanks in advance
D-M
BTW: j is a dynamic variable and it is changed every time I login the page so I can not pass it as string it should be a variable ,

thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Madam deman Leonardo wrote:First of all, I am happy to join this wonderful forum! thanks alot for your support and effort.

Welcome to the Ranch.

First thing: why do you have Java code in your JSP? Is this legacy code that's about 10 years old? Java code in JSPs (scriptlets) have been discredited for almost 10 years now. Modern JSPs should have no scriptlets within them.

However this does not work at all

What do you mean by that? Please say what you expected, and what it isn't doing that you expect. Please read: ItDoesntWorkIsUseless (⇐ that's a link).

BTW: j is a dynamic variable it is changed every time I entered the page because of that I could not add it as astring to the href

Dynamic data is exactly what JSPs are for, so this statement doesn't make much sense.
 
Paul Clapham
Sheriff
Posts: 22487
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would also help if you explained what you mean by "passing a value from one page to another". This isn't really a helpful phrase, as there are several possible meanings for it.

So, what's the relationship between the two pages. Does one forward to the other? Or does one redirect to the other? Or does one produce HTML which includes a form which sends a request to the other? Or is there some other process you had in mind?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!