Announcement Announcement Module
Collapse
No announcement yet.
Browser's back Button with abstractwizardformcontroller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Browser's back Button with abstractwizardformcontroller

    Hi,

    I am creating a quiz application using abstractwizardform controller. I am using 2 jsp pages, first page displays question and second page displays answer. In case if user click browsers back button inbetween the quiz, i want to redirect the user to first question(currently it is showing next question or answer page).
    My problem is I couldn't make out whether user is clicking the normal submit button or browser's back button. Is there any way I can find out, which button was clicked?
    Any help is appreciated.
    Thanks

    Yoshu

  • #2
    We use a hidden _currentPage form field with AbstractWizardFormController and override getCurrentPage to detect if the back button has possibly been used.

    Comment


    • #3
      Hi,

      I have tried by setting _currentpage as hidden field but couldn't able do do it. Can u post some code so that i can gt some hint.

      Thanks,
      Yoshu

      Comment


      • #4
        Code:
        protected int getCurrentPage(HttpServletRequest request) {
        
        	int currentPage = 0;
        
        	if (WebUtils.hasSubmitParameter(request, _CURRENT_PAGE)) {
        		String page = request.getParameter(_CURRENT_PAGE);
        		currentPage = Integer.parseInt(page);
        	} else {
        		currentPage = super.getCurrentPage(request);
        	}
        
        	if (log.isDebugEnabled()) {
        		log.debug("currentPage = " + currentPage);
        	}
        
        	return currentPage;
        }

        Comment


        • #5
          Thanks a lot...Its working now.
          But now I have another problem. I want to bind check boxes with velocity.
          Way i followed is:
          #springBind("questionInfoTO.questionDetails[$count].options")
          #set($options = $status.value)
          #foreach($optionObj in $options)
          #set( $index = $velocityCount - 1 )
          #springBind("optionObj.optionName")
          #set($optionName = ${status.value})
          #springBind("optionObj.id")
          #set($id = ${status.value})
          <tr>
          <td>
          <input type="hidden" name="_user_answer">
          <input type="checkbox" name="user_answer" value="${id}.$optionName" checked="checked"></td>
          <td><b>${id}.</b></td>
          <td>$optionName</td>
          </tr>
          #end

          Could u help me with this..
          Thanks

          Comment

          Working...
          X