Forum Moderators: open
I have written two files that accomplish what i want:
(converted all tags to parenthesis so you can see 'em)
The main .htm file: www.example.com/blogfeed.htm
(c:set var="noShowFooterHTML" value="true" scope="request" /)
(rss version="0.91")
(channel)
(title)Powerful Intentions - Powerful Blogs(/title)
(link)http://www.example.com(/link)
(description)List of the Newest BLOG entries.(/description) (app:blogfeed/)
(/channel)
(/rss)
The app: blogfeed is this tag file:
(%@ include file="/taglibs.inc" %)
(sql:query var="q")
SELECT s.userName,s.subscriberTypeCode,s.name,b.pKey,b.title
FROM Subscriber s, Blog b
WHERE s.pKey = b.memberKey
AND b.blogTypeCode = 'B'
AND b.publishFlag = 'Y'
ORDER BY b.createTimestamp DESC
LIMIT 9
(/sql:query)
(c:set var="hotBlogs" value="(%= new java.util.LinkedHashMap() %)"/)
(c:forEach var="r" items="${q.rows}" varStatus="i")
(c:set target="${hotBlogs}" property="${i.index}" value="${r}"/)
(/c:forEach)
(c:set target="${hotstuff}" property="BLOGS" value="${hotBlogs}"/)
(c:forEach var="r" items="${hotstuff['BLOGS']}" varStatus="i")
(item)
(title)${r.value.name} - ${r.value.title}(/title)
(link)http://${r.value.userName}.${qp:getApplicationBase(pageContext)}
/blog/article/${r.value.pKey}/?comments=Y(/link)
(description)${r.value.title}(/description)
(/item)
(/c:forEach)
OK so my questions:
This file works because the extension is .htm
I can more "properly" also use .xml as the extension
but then the app:blogfeed
is NOT called and just shows up statically.
***SO does anyone know the innards enough or have other
suggestions how to create a dynamic .xml file?
Otherwise I'm stuck with the .htm
Part of why I ask is that this shows up
fine with BlogLines but the new www.google.com/ig
home page will not accept the link as is and
says under "Create a Section"
Your search www.example.com/blogfeed.htm
did not match any feeds.
ALSO if you look at the source for the above link
or any page on the site for that matter there is a
***HUGE*** amount of whitespace at the top of the source...
around 500 blank lines!
Does anyone know how to eliminate these unnecessary blanks?
OR if you have a totally different approach that would
be useful... I am concerned about too much traffic
to these feeds and an alternative to all those
hits and trips to the database may be
automatically creating static files with
a process that uses a cron job that might run every
2 hours or so.
My first post here and Thanks in advance.
Bob OConnor
[edited by: jatar_k at 5:34 pm (utc) on Aug. 17, 2005]
[edit reason] no sigs, no urls thanks [/edit]
At a guess ....
Your container is set to recognise htm as jsp and compile it. Thats why changing to .xml won't work.
I've no idea what BlogLines is but goto [feedvalidator.org...] and check the ouptut.
My guess for the blank lines is that its down to the JSP compiler.
Do you have any control over Tomcat?
I'd probably recommend writing a servlet and controlling the output directly from there rather than JSP.
> When you use the .xml extension I would expect the whole page to be renedered static
> Your container is set to recognise htm as jsp and compile it. Thats why changing to .xml won't work.
Ok
> I've no idea what BlogLines is
just another RSS reader.
>goto [feedvalidator.org...] and check the ouptut.
Great and I did get this error:
"Feeds should not be served with the "text/html;charset=ISO-8859-1" media type
RSS feeds should be served as application/rss+xml"
Where do I set this as a media type... can I put it at the top
of the .htm file and have it override the text/html?
This may explain the google/ig problem.
> My guess for the blank lines is that its down to the JSP compiler.
> Do you have any control over Tomcat?
Sure, I have root access but I am not familiar with Tomcat (I took this
over even though my experience is NOT with java/tomcat etc.)
Easy suggestions here?
> I'd probably recommend writing a servlet and controlling the output
> directly from there rather than JSP.
Can you or others give me some samples and or references for writing
a servlet?
AND thanks!
-Bob OConnor
Add
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
to the jsp servlet
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>.......
</servlet>