• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set JSP Value

 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a two jsp pages. One returns values as appropriate. The other sets a variable in itself by calling the first one and reading the value it returns. This is what I mean:





And another page skeleton,




Any ideas? Thanks in advance.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up the <jsp:include .../> action.
 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Is what I have on my <head>

How then do I call on time.jsp to deliver the appropriate String?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are not methods that you "call". Perhaps you should back up a bit and explain what you're trying to accomplish. You may be barking up the wrong tree.
 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have many jsp pages, each returning things according to its code. However, I have another page that needs the same data, but in one form. So I thought I could get the data by running each of the other pages separately and retrieve the results, instead of having all the code on one page. This is what I mean:

time.jsp displays only the time
ip.jsp displays the next available ip
updateip.jsp > gets the date and the next available ip. This is where I was thinking; instead of replecating time.jsp and ip.jsp functions in updateip.jsp, why not ask time.jsp for the time and ip.jsp for the ip as needed?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Includes are still very useful in JSP but there are better approaches to re-using code than this.

This article by our esteemed sheriff Bear Bibeault explains why and how MVC and scriptless JSP pages work better.
http://www.javaranch.com/journal/200603/Journal200603.jsp#a5
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic