Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7688043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:50:00+00:00 2026-05-31T19:50:00+00:00

I am new to JSP/Servlets/MVC and am writing a JSP page (using Servlets and

  • 0

I am new to JSP/Servlets/MVC and am writing a JSP page (using Servlets and MVC pattern) that displays information about recipies, and want the ability for users to “comment” on it too.

So for the Servlet, on doGet(), it grabs all the required info into a Model POJO and forwards the request on to a JSP View for rendering. That is working just fine.

I’d like the “comment” part to be a separate JSP, so on the RecipeView.jsp I can use to separate these views out. So I’ve made that, but am now a little stuck. The form in the CommentOnRecipe.jsp posts to a CommentAction servlet that handles the recording of the comment just fine. So when I reload the Recipe page, I can see the comment I just made.

I’d like to:

  • Reload the page automatically after commenting (no AJAX for now)
  • Block the user from making more than one comment on each Recipe over a 1 day timeframe (via a Cookie). So I store a cookie indicating the product ID whenever the user makes a comment, so we can check this later? How would it work in a MVC context?
  • Show a message to the user that they have already commented on the Recipe when they visit one
    which they have commented on

I’m confused about using beans/including JSPs etc on how to achieve this.

I know in ASP.NET land, it would be a UseControl that I would place on a page, or in ASP.NET MVC, it would be a PartialView of some sort. I’m just confused with the way this works in a JSP/Servlets/MVC context.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:50:01+00:00Added an answer on May 31, 2026 at 7:50 pm

    you can use response.sendRedirect() or forward APIs in javax.servlet to redirect to a new page or refresh the same page (redirect to the same page/path so that the beans/data gets refreshed)

    about restricting to one comment per day – yes you can use cookie but the problem is that user might use another browser type (chrome, FF, Safari) and will be able to make multiple comments.
    Ideally you should store the lastCommentTime in the model/persistent store and tie it to the user information – this way your model object can expose an API that checks the last comment time and returns true/false depending on whether user can comment or not.
    You can use this API in your servlet/JSP to show/hide the comment button, for example and also show a message

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am familier with jQuery,Ajax and JSP Servlets but new to Struts2.I want to
I am using Spring Web MVC and Hibernate for developing my application. My login.jsp
I have a web application built using jsp/servlets.The web application session is set to
I have to write a website with JSP and Servlets which displays a questionnaire
I want to create simple Spring MVC Hello world application that runs under Jetty
I'm trying to learn JSP/Servlets... I managed to write a function that takes a
Hi im pretty new to jsp and servlets so im having a problem understanding
Hi im new to this Spring , MVC and JdBC support. I want to
I'm new to servlets and jsp, but i can write simple ones. currently on
I am new to Java. But I studies Core Java and J2EE1.4(Servlet N JSP)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.