Solved

Problem: remember the value which is inputted

Posted on 2009-06-29
1
188 Views
Last Modified: 2012-05-07
I have two jsp files. The first jsp accept user input in form and then it calls the second jsp using Form action. And in the second JSP, it passes those two inputs to my Java Bean program, and then accept the output again from java bean and show the result using jstl.

In that case, I accept two inputs but it's opitonal. So, whether entering both two text boxes or either one of it is optional. The problem is say: if the user input in the first text box in the first time and then click the button. It will go to next page and show the result(what my java bean do). And then click the 'Back' button to go to the first page and in this time, if the user input only the second text box, but when passing the value, it also includes the value of the first text box which I have entered in first time.

It used to happen. So, I always have to restart Tomcat server and run the program again to avoid that problem. If not, it happnes like that.

So, how can I do my JSP not to keep the value input when I click 'Back' button.  Here's my two JSP prograsm.

Thanks!!
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="wixIndex.css" rel="stylesheet" type="text/css">
        <title>Web Index</title>
    </head>
    <body>
 
		<%@ include file="header.html" %>
 
        <form name="Name Input Form" action="search-result.jsp">
        	<br> &nbsp;
            <font color="0066CC" size="2"><b>KEYWORD</b></font>  
            &nbsp; &nbsp;
            <input type="text" name="keyword" size="80"/>
            <br><br> &nbsp;
            <font color="0066CC" size="2"><b>CONTENT</b></font>  
            &nbsp; &nbsp;
            <input type="text" name="kwinfo" size="80"/>
            <br><br>
 
            <input type="submit" value="SEARCH" class="button"/>
            <br><br>
 
        </form>
 
    </body>
</html>
 
--------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
 
<%-- 
    Document   : response
    Created on : Apr 9, 2009, 1:39:16 AM
    Author     : May
--%>
 
<%@ taglib prefix="fm" uri="/WEB-INF/matcher.tld"%>
 
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 
<jsp:useBean id="matcher" scope="session" class="com.webIndex.match.FindMatch"/>
 
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="wixIndex.css" rel="stylesheet" type="text/css">
        <title>Web Index</title>
    </head>
    
	<body>
	
		<%@ include file="header.html" %>
		
	   	<jsp:setProperty name="matcher" property="*" />  
	
		${fm:funMatcher(matcher, matcher.keyword, matcher.kwinfo)}
    	
	</body>
</html>

Open in new window

0
Comment
Question by:Juuno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
Murali Murugesan earned 500 total points
ID: 24736200
<jsp:useBean id="matcher" scope="session" class="com.webIndex.match.FindMatch"/>


change  the above to use scope="request"

<jsp:useBean id="matcher" scope="request" class="com.webIndex.match.FindMatch"/>
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
login jsp example 24 86
mysql jsp example issue 32 74
What is the use of Forwarding Class in java 1 37
Netbeans and org.apache.commons.lang3 issue 3 28
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question