0

I have this JSF 2 web application which retrieves a list of tweets from a database and display them as a datalist with Primefaces

(the best is to try it to see what I mean. Go to www.tweetreference.org, click on "read a tweet reference", then input "@seinecle")

How can I make this list bookmarkable, so that one can get back to the page directly? Is it even possible? [I've read about GET requests and bookmarking of urls in JSF2, without success...]

The source code of the page:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>TweetReference</title>
        <h:outputStylesheet library="css" name="index.css" />
    </h:head>
    <h:body>    

        <h:link value="back to the home page" outcome="index.xhtml" />

        <div id="box">
            <div id="text">
                <div id="title">Tweet references for #{controllerBean.searchTerm}:</div>
                <div class="datalist-noborder">
                    <p:dataList value="#{searchResultsBean.references}" var="ref" itemType="none">  
                        <br></br>
                        <br></br>
                        <br></br>
                        <span style="float: left;"><img src="#{ref.author.pic_url}" width="85"></img></span>
                        <span style="font-size: 12px;padding-left: 10px;">
                            <b>#{ref.author.realName} (@#{ref.author.screenName})</b></span>
                        <br></br>
                        <span style="font-size: 12px;padding-left: 10px;">#{ref.author.description}</span>
                        <br></br>
                        <span style="font-size: 12px;padding-left: 10px;"><b>#{ref.author.location}</b></span>
                        <br></br>
                        <span style="font-size: 12px;padding-left: 10px;">[#{ref.author.followersCount} followers on Twitter].</span>
                        <br></br>
                        <br></br>
                        said in #{ref.monthYear}:
                        <span style="font-size: 40px;">&ldquo;</span>#{ref.text}<span style="font-size: 40px;">&rdquo;</span>  
                    </p:dataList>  
                </div>
            </div>
        </div>

    </h:body>
</html>

Thanks!

seinecle
  • 10,118
  • 14
  • 61
  • 120

1 Answers1

0

You are sending the field as POST, to be bookmarkable you need to send as GET. However I read from this answer that you can redirect from POST to GET including the view params, so this might be a solution:

<h:commandButton value="Submit" action="form?faces-redirect=true&amp;includeViewParams=true"/>
Community
  • 1
  • 1
Polyana Fontes
  • 3,156
  • 1
  • 27
  • 41