Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
JSP
Code re-use - what's the best practice
Reggie McDougal
Ranch Hand
Posts: 69
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a reusable piece of code I use for navigation that will be the
same thoughout the application, for navigation in all my
jsp
's.
next, last, previous etc...
Now my question is what is the best practice in storing this code, I need to used the request object as you can see below.
1. Should I use an include.jsp
2. A bean??
If some one could give an idea of what the best appraoch is would be great.
String rowCount1 = request.getParameter("rowCount"); String rowCountType = request.getParameter("rowCountType"); if(rowCountType == null) { rowCountType = "first"; } if(rowCount1 == null) { rowCount = 0; nextRows = 0; showRows = 4; } else { if(rowCountType.equals("last")) { rowCount = Integer.parseInt(rowCount1); rowCount = size - 4; nextRows = size - 4; showRows = rowCount + 4; } else if(rowCountType.equals("first")) { rowCount = 0; nextRows = 0; showRows = 4; } else if(rowCountType.equals("next")) { rowCount = Integer.parseInt(rowCount1); nextRows = rowCount; showRows = rowCount + 4; } else { rowCount = 0; nextRows = 0; showRows = 4; } }
You can never drink too much
Bear Bibeault
Sheriff
Posts: 67637
173
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Perfect opportunity for a custom tag.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how to pass parameter from jsp page to struts action class
pagination with jsp
How to update a image using servlet?
request.getParameter() not working
SQLException: No data found
More...