[Logo] Forums for GrailsFlow, Weceem, XSLfast
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Redirect from controller to a weceem template  XML
Forum Index » Weceem Forum
Author Message
or3L



Joined: 21/06/2010 10:24:35
Messages: 46
Location: Melbourne, Australia
Offline

Hi Marc,

I'm trying to send an instance Job, from my controller: "JobController" to a template.
I will try to explain what I want and what I do.

This is the action "results_weceem" in my "JobController.groovy"


I've also tried


So, in the admin part of weceem at the address "http://localhost:8080/weceem/admin/", I have an HTML Page named "Results Page" in the folder "html-page" and "html-page" is located in the folder "job-search". Phew..
This Html Page have a template named "Template Results Page" in the Extra part.

This is one of my templates in the folder "Templates" at the address:
http://localhost:8080/weceem/admin/ for example



As you can see, I try to retrieve my object "jobInstanceList" in my template. Unfortunately, everything is displayed except jobInstanceList.

So, how I do to achieve what I want ?


Thank you very much.

Aurelien.

or3L



Joined: 21/06/2010 10:24:35
Messages: 46
Location: Melbourne, Australia
Offline

This problem is solved. But I've a new problem.
I've just changed my action results_weceem

and I've add this private method:


This method allow me to pass all the objects I want to the specified uri. Wonderful ! However, I don't know why but the weceem taglib doesn't work anymore for the uri : "job-search/html-page/results-page".

That is to say, if in Weceem I create a template results-page for the uri : "job-search/html-page/results-page" and this template looks like this:


Everything work, but now, if I replace this template by this one:


With this former template, I get this error:


Thank you very much for your help.


or3L



Joined: 21/06/2010 10:24:35
Messages: 46
Location: Melbourne, Australia
Offline

This new problem is solved. However, I would like to ask to a developer from the Weceem Project, if what I've done is well done or not for what I want, and in this case, if this code could be improved or not.
Thus, I repeat my goal. My goal is to render a weceem template or weceem widget, and in this one, I would like to display or use an object/instance from
my controller.

For the first step, I've created a service called "WeceemContentService", see below:


sendToUri return a map with some information such as the object and the uri.
Next, I've created a Groovy class called RenderController, see below:


Now, I can render any widget or template with an object/instance from my controller, see below an example of an action from controller. To achieve that, the controller needs to extends the abstract class "RenderController":



So, I call sendToUri from the service created and I pass the uri for weceem and my object (jobs for example).
Next, I call the method renderWeceemPage from the abstract class with my map and some information from my controller.

And now, thanks to that, everything works. I can render my page with all the design (stylesheets) and my object can be displayed, as well

So, if you have others idea in order to improve this code, I'll be glad.
And I would like to know if this code cause no problem.

Thank you very much.

Aurelien
marcpalmer



Joined: 04/06/2009 13:36:35
Messages: 286
Location: UK
Offline

Hi,

Thanks for using Weceem.

Actually there is a much simpler solution to your problem if you use Weceem 0.9 from trunk. A *lot* has changed in the rendering pipeline internals in 0.9.

Basically in 0.9 you can just do this:



This is how we implement rendering of search and archive results in 0.9, using a content node to allow customisation of the rendering of the results.

- -
Twitter: wangjammer5
Blog: http://www.anyware.co.uk
Grails plugins: http://www.grailsrocks.com
[WWW]
egon



Joined: 04/09/2010 15:42:07
Messages: 2
Offline

Hi marcpalmer,

I tried exactly what you mentioned in your response, but i get this error.

The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers (WcmContent is not intended for rendering).

Any idea? Thanks!
marcpalmer



Joined: 04/06/2009 13:36:35
Messages: 286
Location: UK
Offline

Hi,

First I think that error message was recently fixed, it means "content is not meant for rendering" (not WcmContent).

This means that the URI you gave it does not map to Weceem content that can be rendered. e.g. if you use this to try to view a Template or Widget directly, you will get this.

What URI were you passing and what type is the node at that URI?

Kind regards,
Marc

- -
Twitter: wangjammer5
Blog: http://www.anyware.co.uk
Grails plugins: http://www.grailsrocks.com
[WWW]
egon



Joined: 04/09/2010 15:42:07
Messages: 2
Offline

Hi,

I read your reply and I immediately knew the problem. Indeed i was sending it to a template, not a page. I solved my mistake.

I have a question about storing normal domain objects inside the WCM repository. I have created new content-types to save inside the repository. However, I realized that the content stored in the WCM-repository depends on a content property. If I don't have a content property in my new content-type classes, then it doesn't work. Therefore, if I want to store plain business objects, (for example, Products from an online store), I really can't because a product doesn't really have a content property. It has price, description, quantity, etc. and I don't want to have a content property anyway.

My question is, is there a way of storing non-content data in the repository? I know WcmContent is the class to be extended to create a new content-type, so it seems that the answer is no.
marcpalmer



Joined: 04/06/2009 13:36:35
Messages: 286
Location: UK
Offline

A content repository is meant to store only what you consider content.

What constitutes content is however dependent on your usage of it.

In Weceem 0.9 you do not need to have a "content" property, but you do have to have a way to render your content object - otherwise how can it be useful in a content repository (caveat: WcmTemplate and WcmWidget)?

To change how content is rendered, you either define a getContent() method that returns a string of HTML, or define a static handleRequest closure property that behaves like a Grails controller action and can call any Grails render/related methods. See the source of WcmHTMLContent for example:



The docs for custom types are still being worked on. Your best bet is to look at the source for WcmHTMLContent and WcmExternalLink (which redirects to another site) or WcmAction which executes a script.

This message was edited 1 time. Last update was at 06/09/2010 15:46:17


- -
Twitter: wangjammer5
Blog: http://www.anyware.co.uk
Grails plugins: http://www.grailsrocks.com
[WWW]
 
Forum Index » Weceem Forum
Go to:   
Powered by JForum 2.1.8 © JForum Team