将值从servlet传递到jsp,然后返回到同一jsp

时间:2018-07-07 18:00:57

标签: jsp servlets

需要导航

1.surveyAnswers.java
uuid = UUID.randomUUID().toString(); 
request.setAttribute("uuid", uuid);

2.trainingHome.jsp
<form name="schemesForm" action="SelectTSchemes" method="post">
<input type="text" name="uuid" value="${uuid}" /> 
<input type="submit" value="Start" />
</form>

3.scheme1.jsp
<form name="schemeQuestions" id="schemeQuestions" action="showMessage.jsp" method="post" onsubmit="return displayMessage()">
<input type="text" name="uuid" value="${param.uuid}" />
<input type="submit" value="Create Message" />
</form>

4.showMsg.jsp
<form name="show" method="post" action="home.jsp">
<input type="text" name="uuid" value="${param.uuid}" />
<button type="submit" onclick="show.action='trainingHome.jsp'; return true;">No, try another recipe</button>
<button type="submit" onclick="show.action='home.jsp'; return true;">Yes, continue to the study</button></form>

4.showMsg.jsp调用2.trainingHome.jsp时,“ uuid”不会传回。有没有办法获得jsp中servlet和jsp传递的相同值?有人可以帮忙吗?

0 个答案:

没有答案