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

  • Home
  • SEARCH
  • 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 936031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:14:58+00:00 2026-05-15T21:14:58+00:00

I’m trying to finalize a signup process for my webapp, but am getting confused

  • 0

I’m trying to finalize a signup process for my webapp, but am getting confused with servlet forwarding/redirects (again). The flow looks like this:

// /signup/index.jsp
<form action='/user/signup'>
</form>
<% 
if (request.getAttribute("msg") != null) {
    %><div><%= request.getAttribute("msg") %><%
}
%>

// Servlet which maps to '/user/signup':
public void doPost(..) {
    // process signup params..

    // I want to show the user /signup/index.jsp again after completion:
    req.setAttribute("msg", "signup worked!");
    req.getRequestDispatcher("/signup/index.jsp").forward(req, resp); 
}

when I use the forward() method, the browser shows the url of the post action still:

/user/signup

but the content is of:

/signup/index.jsp 

this is what forward() is supposed to do. I am not sure if this is confusing to the user though – the url is different than the page that actually generated the content.

I stepped through what twitter does, looks like they are foward()ing the user around:

// twitter.com/signup
if (ok) {
    forward("/find_sources/suggestions");
    if (ok) {
        forward("/find_sources/contacts");
        if (ok) {
            forward("/find_sources/anyone");
            if (ok) {
                forward("/");
            }
        }
    }
else {
    forward("/signup"); // error msg displayed here etc
}

In the above, if you mess up on the initial signup page, your browser shows the /account/create url, but the content of the page looks like /signup – so I guess they’re doing the same thing I am (I am just assuming the underlying forward()/redirect() options are the same for all http servers, not specific to jsp).

Is my flow normal then? Should I be doing this some other way? I guess the options are:

  1. Use forward() and accept that the url will be of the action url.
  2. Use redirect() and store any messages I want to show the user in a session.

Thank you

  • 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-15T21:14:58+00:00Added an answer on May 15, 2026 at 9:14 pm

    If you wish to do what twitter does – make all the validation in-line – i.e. display validation errors with AJAX. Then the users will click “register” only if they have completed everything correctly and the fact that forward is used won’t be much of a problem.

    However, in the general case, try to find some conversation framework (like spring web flow), or something similar to JSF’s @ViewScope – i.e. something between request and session to accommodate this use case.

    Another option is to use redirect and clear the contents of the session that have been just set.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string

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.