[b][red]This message was edited by stricks at 2005-6-1 13:40:40[/red][/b][hr]
Hello,
I have to "submit" buttons on my servlet:
----------------------------------------------------------
out.println(" ");
out.println("");
----------------------------------------------------------
They send me to a JSP page that looks like this:
------------------------------------------------------------
<%
//////////////////////////////////////////////////////
// All of this just increases/decreases //
// the page count so that it //
// knows to go to the next question. //
//////////////////////////////////////////////////////
String pageCounter = (String) session.getAttribute("pagecount");
int pageCount = Integer.parseInt(pageCounter);
String Add_Sub = request.getParameter("move");
String Add_Sub1 = request.getParameter("prev");
pageCounter = String.valueOf(pageCount);
session.setAttribute("pagecount", pageCounter);
%>
------------------------------------------------------------------
Now what I need to do is increase (if they click the Next Button) or decrease (if they hit the Previous button) the pageCounter by 1 (--/++).
Any suggestions?
Thanks,
Brian
Comments
Hope this helps you out.
--=][tReShR][=--
: Hello,
:
: I have to "submit" buttons on my servlet:
: ----------------------------------------------------------
:
: out.println(" ");
:
: out.println("");
:
: ----------------------------------------------------------
:
: They send me to a JSP page that looks like this:
:
: ------------------------------------------------------------
: <%
: //////////////////////////////////////////////////////
: // All of this just increases/decreases //
: // the page count so that it //
: // knows to go to the next question. //
: //////////////////////////////////////////////////////
:
: String pageCounter = (String) session.getAttribute("pagecount");
: int pageCount = Integer.parseInt(pageCounter);
:
: String Add_Sub = request.getParameter("move");
: String Add_Sub1 = request.getParameter("prev");
:
: pageCounter = String.valueOf(pageCount);
: session.setAttribute("pagecount", pageCounter);
:
: %>
:
:
:
: ------------------------------------------------------------------
:
: Now what I need to do is increase (if they click the Next Button) or decrease (if they hit the Previous button) the pageCounter by 1 (--/++).
:
: Any suggestions?
:
: Thanks,
:
: Brian
:
:
:
name them both (submit buttons) name="move"
in the jsp page
[code]
String resp=request.getParameter("move")?request.getParameter("move"):"";
if ("Next".equals(resp)){
pageCount++;
}
else if("Previous".equals(resp)){
pageCount--;
}
[code]