Reputation: 309
Hey everyone thank you for taking your time to answering my question, I am currently working with a java web application in eclipse quit a new to it, the website contain a form and it takes a few steps/pages for user to complete it, in the header part i have a master page with few picture i wish to show user what step they currently on the form i had another page contain the form with submit logic etc.
Page 1: The master page, here is the page contain images and bit of logic which i hoping to show the process to user by displaying different picture.
<div style="text-align: center; padding-top:5px;" >
<%if (Steps == 1){ %>
<img src="../../images/nivagationArrow1Highlight.png">
<%}else{ %>
<img src="../../images/nivagationArrow1.png">
<%} %>
<%if (Steps == 2){ %>
<img src="../../images/nivagationArrow2Highlight.png">
<%}else{ %>
<img src="../../images/nivagationArrow2.png">
<%} %>
<%if (Steps == 3){ %>
<img src="../../images/nivagationArrow3Highlight.png">
<%}else{ %>
<img src="../../images/nivagationArrow3.png">
<%} %>
</div>
page 2 the form, which display above page like header :
**<jsp:include page="/form/Page1.jsp" flush="true"/>
<form id="Form" action="confirmation.jsp" method="get">
<input id="FormMain" type="" name="formInput" value=""></input>
<input id="1Form" type="" name="formInput" value=""></input>
<input class="submitBack" type="button" onclick="history.go(-1);" />
<input class="submitNext" type="button" onclick="javascript:submitForm();" />
</form>
page 3 simply have another form(check-boxs) and bunch of information etc.
page 4 showing message user had completed to the form and thanks them.
here is my question: I tried to including java code <% int Steps=1;%> in page two and hope for master page will pick up the parameter and do the logic, but nothing happen. how can set a parameter in page to so the master page can read it ?? Is here another way or better approach ??
thanks again for your comment,appreciate !!
Upvotes: 0
Views: 84
Reputation: 200
try:
page 2:
<% int Steps=1;%>
<jsp:include page="/form/Page1.jsp" flush="true">
<jsp:param name="Steps" value="<%= Steps %>">
</jsp:include>
page 1:
${param.Steps} || request.getParameter("Steps")
Upvotes: 1