• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a forum

 
Karabo Mashiyane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys . I'm currently studying java and I am busy with my Project, which entails creating a forum.
I wnted to know ; How do i display user user topics and replies. Is it ok to use expressions to display these on my
Jsp.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best case scenario, there are no scriptlets, expressions whatsoever in your JSP.
Well, expressions is a maybe but for scriptlets there is almost never a reason to use them.

You might want to check out JSTL and EL (Expression Language).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also want to read this article for info on properly structuring web apps.
 
Karabo Mashiyane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice guys. Would also like to ask: is there a way for me to send back data to a requesting Jsp frm the processing jsp or should i consider using the jsp include action. I have been struggling to find a solution.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karabo Mashiyane wrote:Thanks for the advice guys. Would also like to ask: is there a way for me to send back data to a requesting Jsp frm the processing jsp or should i consider using the jsp include action. I have been struggling to find a solution.

So you plan to ignore the advice that you thanked us for? The term "processing JSP" should be in no one's vocabulary.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here is the deal for web-apps if you don't use any fancy frameworks.

1. Request from browser comes in (e.g. http://localhost:8080/myWebApp/SomeResource
2. SomeResource is ideally mapped to a Servlet which is in charge of processing the request
3. The Servlet processes the request (all the logic behind it, collecting the data that should be shown to the user, writing updates to the database etc.)
4. The Servlet is done. It wraps up all data to be displayed in beans, lists etc and puts those into the request scope
5. The Servlet forwards the request to a JSP, which is the presentation layer.
6. All the JSP does is render and display what has previously been calculated in the servlet. It does NO calculations on it's own. It's sole purpose is to display.

This way you have a clear cut between logic and presentation.

Note that this is the easiest way. In general you would strive for the MVC pattern and have the servlet be the controller and delegate the logic to external classes and services to enhance reusability.


Hope that helps, cheers.
 
Karabo Mashiyane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sebastion thanks alot. Thats a reliever. Bearbault am not trying to ignore anything. I'm still learning.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!