Calculate the stage changes correctly

git-svn-id: http://webgoat.googlecode.com/svn/trunk@161 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
rogan.dawes 2007-07-11 12:52:23 +00:00
parent 851974d7ce
commit cb794dcb50
2 changed files with 2 additions and 3 deletions

View File

@ -924,7 +924,7 @@ public class WebSession
RandomLessonAdapter rla = (RandomLessonAdapter) al;
int stage = myParser.getIntParameter(STAGE) - 1;
String[] stages = rla.getStages();
if (stage>0 && stage <= stages.length)
if (stage>=0 && stage < stages.length)
rla.setStage(this, stages[stage]);
} catch (ParameterNotFoundException pnfe) {}
}

View File

@ -200,7 +200,6 @@ StringBuffer buildList = new StringBuffer();
</div>
<%
AbstractLesson al = webSession.getCurrentLesson();
System.out.println("AL is a " + al.getClass().getName());
if (al instanceof SequentialLessonAdapter)
{
SequentialLessonAdapter sla = (SequentialLessonAdapter) al;
@ -227,7 +226,7 @@ StringBuffer buildList = new StringBuffer();
<%
String stage = rla.getStage(webSession);
for (int i=0; i<stages.length;i++) {
%><option <% if (stages[i].equals(stage)) out.print("selected"); %> value="<%= i+1 %>">Stage <%= i+1 %></option>
%><option <% if (stages[i].equals(stage)) out.print("selected"); %> value="<%= i+1 %>"><%= stages[i] %><%= rla.getLessonTracker(webSession).hasCompleted(stages[i]) ? "*" : "" %></option>
<%
}
%></select></form><%