0

I would like to use view parameters to get bookmarkable URLs with JSF 2, but I use JSPs and all the help and examples I can find, uses facelets. Here is want I have done so far:

search.jsp (calling page):

  <t:commandLink action="...">
      <f:param name="param1" value="foo"/>
      <h:outputText value="..."/>                  
  </t:commandLink>

faces-config.xml:

  <navigation-rule>
    <navigation-case>
      <from-outcome>go_edit</from-outcome>
      <to-view-id>/views/edit.jsp</to-view-id>
      <redirect>
        <view-param>
          <name>param1</name>
          <value>#{edit.param1}</value>
        </view-param>
      </redirect>
    </navigation-case>
  </navigation-rule>

Edit.java (edit page backing bean):

public class Edit extends ... {

  private String param1;

  public String getParam1(){
    return param1;
  }

  public void setParam1(String param1){
    this.param1 = param1;
  }

  ...
}

I think the problem is, that I didn't add the view params to the edit page (e.g. edit.jsp). I only found facelet examples, which look like this:

<f:metadata>
    <f:viewParam name="id" value="#{bean.id}" />
</f:metadata>

My question is, can I use JSP view params? Can someone provide or point me to an complete example? Especially the part with the target page (e.g. edit.jsp).

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
Tim Büthe
  • 58,799
  • 16
  • 82
  • 126

1 Answers1

2

This isn't possible. JSP is deprecated since JSF 2.0 in December 2009 (almost 4 years ago already!). All new JSF 2.x specific tags are available to Facelets only and not to JSP. Basically, with JSP you've only JSF 1.x specific tags available. In other words, the JSF 2.x tags <f:metadata>, <f:viewParam>, <f:ajax>, <h:head>, <h:outputScript>, etc are not available to JSP.

There's no point working with deprecated technology. It's high time to migrate.

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Well, not the answer I hoped for, but an answer nonetheless. Thanks! The thing is, the application is more than 7 years old and contains more than 1000 JSPs, custom components, etc. We gonna migrate eventually, but I had hoped I could get bookmarkable URLs working in the near future. – Tim Büthe Nov 13 '13 at 12:54