Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dynamically creating jsp pages?  RSS feed

 
Yves Carlson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm fairly new to server-side of java, so I have some noobish questions about servlets and jsp technology.

From what I can tell, most books on the subject teach something like this: you get data you need from database,and then in the bean when you want to display results you forward data to jsp page.(ex. RequestDispatcher)
And in jsp page you simply use EL and taglibs to cycle data.So, jsp page here serves as some kind of template which you fill with data. All good with that.

However, let's say I get some data from database, and want
to display each row (or something more complex) in its own jsp page. So perhaps I'll have to create on the fly 10,20..... X number of jsp pages.

So, my question would be:

1. How does one proceed with this? (so, to say,how do you dynamically create jsp pages?) And how would you track user input in this case?

2.What if I want jsp pages to be valid for certain amount of time? So, once timer expires I could make them unavailable or something else? What would be easiest way to implement timer on the server to keep track of them, and what would be best way to implement this (hopefully without external jars i.e.Quartz and such) ?



Thank you for help !
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yyves,
Usually one creates one JSP page and fills in different data. For example ".../detail?key=1" could display the info about a bike and ".../detail?key=2" could display info about a coat and etc.

They are separate pages,b ut share a template. Are you saying you don't have a common template? How do you know what the layout should be?
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As "Jeanne Boyarsky" had already told you don't need to create different pages.
You can have a single page and show the data depending on the key passed to the page.
And to make a page unavailable after certain time again you can have a check in the page itself and display the error page if the time limit has been expired.
 
Yves Carlson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, thank you for help, you are right, there is no need to create all those pages...(did some more research)....


Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!