Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31341

[JSP] Request contains data from input button which doesn't exist any more

From Peter Müler <user@example.net>
Newsgroups comp.lang.java.programmer
Subject [JSP] Request contains data from input button which doesn't exist any more
Date 2015-03-20 23:42 +0100
Organization albasani.net
Message-ID <mei7p4$qtk$1@news.albasani.net> (permalink)

Show all headers | View raw


I have the following problem: sometimes the JSP page shall show a button 
(at state==0).
When the button is pressed the state changes and the button shall not 
occur anymore.
The code below works as desripted.
But when I reload the page the request still contains data of the button 
which doen't exists anymore. Also the introduction of a hidden button 
dosn't change anything.
How can I get the information that the button is truly pressed?



String myButton = request.getParameter( "MyButton" );
if (myButton != null && myButton.equals("Ok")) {
	// code below is being executed after "MyButton" is pressed and each 
time the page is reloaded
	storeState( 1 );
	out.println( "<input type=\"hidden\" name=\"MyButton\" 
value=\"hidden\"/>" );
	// Do something
} else if ( state == 0 ) {
	out.println( "<input type=\"submit\" name=\"MyButton\" value=\"Ok\"/>" );
}

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

[JSP] Request contains data from input button which doesn't exist any more Peter Müler <user@example.net> - 2015-03-20 23:42 +0100

csiph-web