Hi Helmut,

ok, now the id makes sense to me, thanks for explaining.

Please find attached my faces-config.xml, the page (browse.jsp) and the
relevant controller (BrowseController.java). The code for getting at the
link parameter doesn't quite work yet but as that is not the primary
problem I did not put much effort into fixing it yet.

Thanks in advance,
Ramon


Am Donnerstag, den 08.11.2007, 12:46 +0100 schrieb Helmut Swaczinna: 
> Hi Ramon,
> 
> some words to the id of the link: The "0" is the number of the row in the
> sheet. Because a panel is no
> naming container it's id is not part of the concatenated id. Moving the link
> from one column to another
> has no effect to the id of the link. The column id is not part of the
> concatenated id. The server identifies
> the action associated with the link by the id of the link. If you have the
> same link in more than one
> column the ids of the links must be different. So there's no problem with
> the id.
> 
> To locate the problem we should have a look at the sources. Can you post the
> complete page, the faces-config
> and the related snipplets from you java source?
> 
> Regards
> Helmut
> 
> ----- Original Message ----- 
> From: "Ramon Ziai" <[EMAIL PROTECTED]>
> To: "MyFaces Discussion" <[email protected]>
> Sent: Wednesday, November 07, 2007 8:22 PM
> Subject: Re: [Tobago] Weird problem with tc:link inside tc:sheet
> 
> 

Attachment: faces-config.xml
Description: application/xml

package controller;

import java.util.List;

import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.myfaces.tobago.model.SheetState;

import model.Corpus;
import model.Document;

public class BrowseController {

	private Document selectedDoc;
	private HttpSession session;
	private Corpus currentCorpus;
	private SheetState docTableState;
	private List<Document> docList;
	
	public BrowseController() {
		System.err.println("BrowseController constructor called");
		session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
		currentCorpus = (Corpus) session.getAttribute("currentCorpus");
		HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
		docList = (List<Document>) request.getAttribute("docList");
	}
	
	@SuppressWarnings("unchecked")
	public void linkClicked(ActionEvent e) {
		System.err.println("linkClicked() called");
		Object value = ((UIParameter) e.getComponent().getChildren().get(0)).getValue();
		System.err.println("Param value is " + value);
		int docId = Integer.parseInt((String) value);
		selectedDoc = currentCorpus.getDocument(docId);
	}
	
	@SuppressWarnings("unchecked")
	public String selectDocument() {
		System.err.println("selectDocument() called");
		List<String> searchTerms = (List<String>) session.getAttribute("searchTerms");
		String docText = null;
		
		if (searchTerms != null) {
			docText = selectedDoc.getMarkedUpText(searchTerms);
		} else {
			docText = selectedDoc.toString();
		}
		HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
		request.setAttribute("docText", docText);
		return Outcome.VIEWDOC;
	}

	public SheetState getDocTableState() {
		return docTableState;
	}

	public void setDocTableState(SheetState docTableState) {
		this.docTableState = docTableState;
	}

	public List<Document> getDocList() {
		return docList;
	}

	public void setDocList(List<Document> docList) {
		this.docList = docList;
	}
}

Attachment: browse.jsp
Description: application/xml

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to