Hi Rory,
try setting the jcr:mimeType property of the /forms/widgets/
createNewWidget.html/jcr:content node to text/html. This should do the
trick.
If you want to have a JSP that just executes, try to create a dummy
content node with a sling:resourceType that points to your JSP file.
regards,
Lars
On 28.07.2008, at 22:16, Rory Douglas wrote:
Thanks Toby
I guess my question is even simpler then - where do you store those
forms? I've tried uploading .HTML forms to the repository:
curl -X PUT -d @createNewWidget.html "http://admin:[EMAIL PROTECTED]:8888/forms/widgets/createNewWidget.html
"
When I request that path (/forms/widgets/createNewWidget.html), my
browser tries to download me the source rather than display the
HTML. I assume I need to add some kind of contentType attribute
when I upload the form, I'll look into that.
Also, how would I deploy a dynamic form (say, JSP-based), that might
configure it's display, default values etc differently based on
request params, cookies etc? Since JSPs in Sling appear to be
either precompiled with JSPC or compiled when requested as the the
script corresponding to a resource type, would it work to just put a
JSP script somewhere in the repo?
Tobias Bocanegra wrote:
hi,
On 7/28/08, Rory Douglas <[EMAIL PROTECTED]> wrote:
I have registered a couple of custom nodetypes with corresponding
rendering
scripts html.jsp in the appropriate folder. Now I'd like to
include a few
simple forms to create that node type (re-using as much existing
functionality as possible). What is the best way to do this?
I had a few ideas: (assume I have a nodetype test:Widget with a
display
script /apps/test/Widget/html.jsp)
1) Create "form" nodes (/forms/Widget/create)
a) use sling:resourceType="form:Widget"
b) register a script /apps/form/Widget/html.jsp that generates
an HTML
form (and uses the SlingPostServlet to create the content)
2) Create an "empty" Widget node (/content/Widget/new)
a) use jcr:primaryResourceType="test:Widget"
b) register a script with a "create" selector
apps/test/Widget/create.html.jsp that generates the HTML
form
you can simply use a form that posts to the node you want to
create, eg:
<form action="/content/newnode" method="POST">
<input type="hidden" name="jcr:primaryType" value="test:Widget"/>
<input type="text" name="title" value="" />
<form>
I assume I could also register new servlets by paths, and then
either
directly create content or somehow forward to the
SlingPostServlet. In all
cases where I use the SlingPostServlet, what's the best way to
handle
failures or errors?
you can either post to a hidden frame, and the read the response via
the DOM or use an AJAX post and read the response.
regards, toby
--
Rory Douglas | Senior Principal Consultant
Fax: +1-201-604-6428 | Mobile: +1-917-498-5344
Oracle North America Consulting
ORACLE United States | | San Diego, CA
"Please consider your environmental responsibility before printing
this e-mail"
--
Lars Trieloff
[EMAIL PROTECTED] / +49 173 6169716
http://wiki.day.com/content/wiki/Users/ltrielof.html