I'm trying to put PrettyTime into JSP as a tag. Found this page - http://www.ke-cai.net/2010/03/formatting-time-with-prettytime-jsp-tag.html - as the only source of the tag. But I've never used Maven, so I can't figure out how to get that prettyTime.tag file along with the source code. Can someone suggest something or should I just go ahead and write a tag myself?
From what I can see in that article, all Maven will be doing is pulling in the java library. You can do this manually, and include it in your standard way (ie, in your "lib").
He seems to be telling you then how to write your own jsp tag (suggesting you call it "prettyTime.tag"), and then how to reference it.
Side note, you may want to consider reading up on and adopting Maven, its quite a powerful build management helper for java web app development.
That's just a blog of someone else. It's available by the manufacturer's site: http://ocpsoft.com/prettytime/
It's however a JSF tag, which means that you have to install and use JSF as well.
Instead of using a server-side component, you can use javascript. See the jQuery timeago plugin
Related
I have a pretty large web application that I am converting from struts1 to struts2. I have been looking into everything I need to change in the jsp files but I also have many java files that I assume will need to be changed as well. In my login.jsp file there is a directory included that has a Header.java file. In this file as well as many others, these two lines are at the top:
import org.apache.struts.config.MessageResourcesConfig;
import org.apache.struts.util.MessageResources;
What do I need to change these lines to in order to make it work with struts2?
MessageResourceConfig and MessageResource are Struts1 classes to handle the message resources files. You can find some info about this functionality in many tutorials and examples, like this: http://www.laliluna.de/articles/posts/struts-message-resources-tutorial.html. In Struts2 the same functionality is handled automatically by the framework, but to know how it works and what you should do I suggest to you to take a look at the official website of Struts2:
https://struts.apache.org/getting-started/message-resource-files.html.
As you'll see in the official documentation you won't need anymore the two imports.
I'm working on learning JSP and the Play framework, and I understand that it runs on Scala and renders views based on templates, but what if I just want to use plain HTML rather than scala templates?
The situation I'm in is that I'm designing the site to match a visual template, so I'm using Dreamweaver to build the html files. I really like Play framework though, so I'd like to continue using it. So, what are my options here?
I don't get. Play's views are not just nice html files, of course you can (or even should) use your favorite tools for design part, anyway you have to also learn how to include a dynamic parts in it.
Of course you can use DreamWeaver for that task as it has feature for editing source code. But I can ensure you from my own experience, that there are better tools for every-day work with Play's views than DW.
You can also use plain HTML in your /public folder however in this scenario you won't be able to make it dynamic, so it has no sense, as you can create the pages without any framework - just using static files created with DW.
In general words: you need to verify your needs, cause from your question I read: "I like Play framework, anyway I don't want to use it for its job..."
After-comments edit:
You don't have to make views dynamic. If you won't pass any arguments into the view and will put there pure HTML it will be 'relatively cheap' way for displaying static pages as well. Just you need to remeber to leave first line of the file empty. So you don't need to use File index = new File... instead just put your bare HTML code into ie: app/views/staticContact.scala.html and then use an action:
public static Result staticContact(){
return ok(views.html.staticContact.render());
}
On the quite other hand, last time I was wondering if it wasn't better to put HTML code of the static pages into the DB, in such case you could create an editing page, where you could change HTML without redeploying the application. All what you will need it was just fetching HTML from DB and displaying it in one generic view. For better performance you can use included Cache implementation.
GET / controllers.Assets.at(path="/public/html", file="index.html")
This is working for play 2.0.1 for /public/html/index.html file
I am looking out for a css validator library that I can use in my java application. I have checked out this. http://jigsaw.w3.org/css-validator/manual.html. But according to my understanding that needs to be run on a server locally or used as a command line tool. Correct me if I am wrong here.
Thanks in Advance
Behind the link you have posted there is a webservice which you can use to validate your CSS files. But you have to be online for doing this. There is also an offline version available: http://jigsaw.w3.org/css-validator/DOWNLOAD.html which you might can embed in your application.
I am trying to build a search engine using java and the lucene API as part of a project. For the last step, we plan to build a web UI (a local host would do) for the same. Are there UI softwares/plugins for eclipse which will allow me to call the functions present in the java classes?
Essentially I would want to have a search box and a search key, pressing which will throw up the search results(which is computed from the java program). javascript cannot call java code I understand. So using that is eliminated?
Any suggestions on what to use will be greatly appreciated. I have pretty poor knowledge in front end design!
Cheers!
AB
If all you have is a simple screen with a entry field and a button and you simply want to return an html table. I would go with a servlet and two jsps. Your servlet can call your search engine and then have the jsp format the data into the table. If you do not know web apis this is probably the easiest entry.
I think, If your using JAVA, that you should look into JSF.
It's a rather easy to maintain and work with library for just the uses you describe.
I recommend these tutorials to get you started: http://www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro
There are lots of options to achieve this.
you can create web-ui using jsp.
I have also created same type of project using Lucene, here i have used spring mvc.i have provided all the back-end process as REST api which any web-ui can use.
Please do not look into JSF; it is an overengineered pile for your task.
Sure you can call your java code from javascript, you can make it really simple with something like DWR.
However, for your project I would suggest GWT as then you only deal with Java and it will generate javascript, html and css for you.
For your project you dont really need an "enterprise" level framework like spring or a fullstack JavaEE, you could keep it real oldschool with only JSPs and html/javascript. However thats a bit too flaky for my taste, so go with GWT.
With GWT you basically set it up, define your module, entrance point (look at the hello world), and then you add a layout to your page like something to place the searchbox into and the resultbox to. Then you call your other Java code and classes from there like you normally would.
I would suggest you to use GWT in your application because GWT enables you to call java methods and it will also convert Javascript and css for your Java modules after GWT compile.
GWT reference :- http://code.google.com/webtoolkit/gettingstarted.html
If you're going to use GWT, you could aslo check Vaadin.
Creating a search UI is really simple, and the tutorial show a criteria /result table application taht could be adapted.
I work on an open source project that is hosted on google code. I'm using ant to create javadocs and I'd like to have links to the source files. I understand I can use the linksource flag to javadoc to include the source in the resulting html, but this isn't what I really want. What I'd prefer is to provide a link to the source file in google code's svn browser. I suppose I could do a simple filter prior to running javadoc, but it'd be even better if I could figure a way to do this right in javadoc. Ideally, I could have a property in my ant properties file like
base.src.url=http://code.google.com/p/myproject/source/browse/branches/1.2
and the javadoc command would add a line to each class's html file:
see source on google code
Any ideas?
The standard doclet offers no such option, as far as I know. So it looks you either have to
use an alternative doclet,
patch the standard doclet,
preprocess the Java files or
postprocess the produced HTML.
A feature request to include this in the standard doclet might also be a good idea.