• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP calling a method  RSS feed

 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! I'm having a design problem right now. You see I have 5 or more JSP pages and these pages need to perform similar functions ( they need to produce a certain login token given a login string ). With this in mind, I was wondering if it is a good practice to just create a class and from that class I'll create a certain method, let's say produceLoginToken( String param ), and within my JSP pages I'll just import the said class and use that method. I'm quite not sure about this approach because normally I would send my data from a jsp to a servlet for processing but, this time I'm not allowed to use servlets. At the same time, It is more advisable to keep the procesing out from the JSP pages. Care to give some insights? Thanks!
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See MVC Pattern
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anything else?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This time you're not allowed to use servlets?

Did a rogue servlet accidently escape last time and trample someone?

Here's a link that describes the MVC pattern in more detail. Basically you would use a servlet as a "Front Controller" to intercept client requests, set up the data needed, and forward the request to the appropriate JSP.

I suppose you could also use an intercepting filter for this sort of thing, too...
[ May 19, 2004: Message edited by: Nathan Pruett ]
 
Jeffrey Hunter
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not allowed to use Servlets??? How about a Servlet in-cognito (aka JavaBean)?
[ May 19, 2004: Message edited by: Jeffrey Hunter ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!