• Post Reply Bookmark Topic Watch Topic
  • New Topic

A jsp that has an XML file extension, server mappings

 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am wanting to make a dynamic XML file, sitemap.xml.

I want this to change when the content held in the database changes.

I have done this in PHP but do not know whow to do this in java.

I would expect that somewhere in my server (tomcat) I can map sitemap.xml to sitemap.jsp, possibly. So when I call sitemap.xml it will infact run sitemap.jsp and return the dynamic content.

Is this possible?

Thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65529
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess, but it certainly seems like a lot of jumping through unnecessary hoops. Why not just have a servlet to serve the XML content? Much easier. Why do you feel you need a JSP?
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can do that as well I suppose.

So I would just set up the mapping sitemap.xml straight to the servlet?

I just always use JSPs and never servlets, not written one in years I think.

'He who's only tool is a hammer only sees nails' I suppose.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65529
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um yeah. You can pound in a screw with a hammer, but ...

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Rocks wrote:I just always use JSPs and never servlets, not written one in years I think.

That seems backwards to me.
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:
David Rocks wrote:I just always use JSPs and never servlets, not written one in years I think.

That seems backwards to me.


Why, I could be a swing developer for all you know.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use JSPs in Swing?
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:You use JSPs in Swing?


I would not have a problem in putting the logic into a JSP and mapping the xml file to the jsp.

I wrote the servlet on the train home and I thought about the xml file as a jsp or a servlet.

If I was to do a sitemap.jsp with a sitemap.xml the it would be natural to place the same logic of a sitemap.jsp into a sitemap.xml.

There is no specific architectural reason why the logic has to go into a servlet.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:
David Rocks wrote:I just always use JSPs and never servlets, not written one in years I think.

That seems backwards to me.

But pretty normal around here. Just watch and you'll see all the posts which say "Don't do that in your JSP, only do what is necessary to output the view". That's a large fraction of the threads about JSP. I don't understand why people only use JSPs either, it doesn't seem very professional to me, but then not everything has to be professionally done.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!