2012-12-14 93 views
0

我有这样的JSF 2的Web应用程序,它从数据库中检索鸣叫的列表,并显示它们与Primefaces一个DataList书签在JSF页面2应用

(最好是尝试一下,看看有什么我点击“阅读推文参考”,然后输入“@seinecle”)

我该如何让这个列表为可收藏的,这样人们可以直接返回页面?它甚至有可能吗? [我读过有关GET请求,并在JSF2网址书签,都没有成功...]

页面的源代码:

<?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> 

谢谢!

+0

使用GET而不是POST –

+0

是的,我想是这样。你能更明确吗? – seinecle

回答

0

您正在发送该字段为POST,要加入书签,您需要发送为GET。但是我从this answer阅读,你可以从POST重定向到GET包括视图参数,可以所以这可能是一个解决方案:

<h:commandButton value="Submit" action="form?faces-redirect=true&amp;includeViewParams=true"/>