Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html view resolver

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

I am attempting to write a web app without JSPs, just HTML and ajax. I am trying to use Spring 3 MVC. I am having trouble resolving HTML views . . .
I need something like :



But this doesn't work. Wondering how to resolve static content. Thanks. Eric.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does it not work? What error or exception are you getting? What does your Controller code return?

Thanks

Mark
 
Albert Liptay
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alas, 1 year later I'm trying to do the same thing.

I'm on this contract where the UI designer does not and will not fire up a web app in eclipse to make changes. So I'm trying to architect a solution whereby the static code loads from the file system, a kinda pure HTML.

I'm willing to for go MVC, and java templating engines, however I cannot find any precedence. I've read up on a templating engine called Thymeleaf which probably would give me much needed mileage.

For now, we're trying static html using jQuery to populate selects and forms after the page load. Essentially forgoing any traditional servlet based controllers, except for the RestEasy service points to serve JSON

Wish me luck.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really like ICanHaz.js for templating, it is built on top of mustache.js Makes it very simple to render the template on the client side in javascript with just one line of code

ich['templateName](dataInJSonFormat);

returns the html of the rendered template.

so

var contents = ich['templateName](dataInJSonFormat);
$("#someDivId).html(contents);

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic