0

Whenever we want to send parameters from one jsp page to another we use the following lines of codes, what if we want to send parameters in JSF, like sending one parameter from one Facelets page to another. 1)First Page

<html>
    <head><title>Test Page 1</title></head>
    <body>
        <%String forwardToPage="/2.jsp?Key=1234568&Schema=COM";%>
        <jsp:forward page = "<%=forwardToPage%>" />
    </body>
</html>

2) Second Page

<html>
    <head><title>Test page 2</title></head>
    <body>
        <%
            out.println(request.getParameter("Key") + " KEY " + request.getParameter("Schema") + "   SCHEMA " );
        %>
    </body>
</html>
fejese
  • 4,601
  • 4
  • 29
  • 36
Wizard Sultan
  • 830
  • 7
  • 22
  • 45

1 Answers1

1

There are two commons ways: using a <f:viewParam> and using an embedded #{flash} object. Both ways are covered in the answers to jsf2.0 - How to get the values in other jsf page's bean in request scope, the first one by partlov, and the second one by myself.

Also, BalusC's answer to What can <f:metadata> and <f:viewParam> be used for? question is a great starting step.

Community
  • 1
  • 1
skuntsel
  • 11,624
  • 11
  • 44
  • 67