I'm setting up a new web app and came to know that the company name is spelled incorrectly in all the web pages. So, I want to change it in all of them. I am using eclipse neon.
Is there any way to add or replace text from all the web pages in Eclipse ? or Will I have to change them manually one by one?
Tried using ctrl+shift+R but it's for the change of method or variable name in eclipse.
The eclipse IDE is mainly a programming tool, and as such it also supports:
searching for files using wildcards
replacing content using regular expressions within all finds matching your condition
Simply turn to Search"->"File" and enter your search text, a file pattern and then use replace!
And of course: the real answer is to step back and look into what you are doing! Such repeating information (that has to be always the same in many different places) should always come out of 1 source file, not out of 120 different files. That comment about "don't repeat yourself" is the real solution here!
I think, it is better to create a separate header page and separate footer page and include them in all web page. So next time if you make this type of mistake you should not think about the all page, you can just change in one page and see the change in all page.
Eclipse - Search - File..
in this example will be replace "conpany" in all jsp's with 'company'
Related
I use iText to batch enable shared reviews in pdf files at the server level. Injecting the required javascript is accomplished using the PdfStamper's addJavascript() function. This does enable the shared review, however i cannot create archive versions properly because the document level javascript "Script Name" is not correct. iText sets the Script Name sequentially starting with 0000000000000000, then 0000000000000001, etc. I need to set the Script Name to "com.adobe.acrobat.SharedReview.Register" instead. Is there any reasonable way to accomplish this?
I had to check the iText source code myself, and to my surprise I discovered that we overlooked a method. There was supposed to be a method that allows you to choose the name, but there isn't.
You can work around this by adding the JavaScript straight to the writer:
stamper.getWriter().addJavaScript(
"com.adobe.acrobat.SharedReview.Register",
PdfAction.javaScript(js, stamper.getWriter(), !PdfEncodings.isPdfDocEncoding(js)));
where js is the JavaScript you want to add.
Granted, this isn't elegant. Let me know if this works, and I'll see if I can add the extra method in one of the next releases.
I'm a new programmer at a software house, and let's just say I can't make too much modification that includes a major changes, for example like adding library. In the current project, we're using JSP and Servlet, and some other advanced GUI that I never knew (they said it's a derivative of Eclipse, called Enfinity). The Enfinity also hides the libraries under obscure locations, and it's very different than in Java. So I don't think I will able to understand about the library location too, moreover adding some new library.
The problem here, I need to escape HTML characters like &, <, >, ", and ', but when I search solution on the internet, usually the solution involves using JSTL ( c:out or ${fn:escapeXML} ) or importing a library (Spring's HTMLEscape, or Apache's StringEscapeUtils). JQuery, on the other hand, is imported, but sadly, not related to solution. But the problem is JSTL is not part of the library readily imported into the project. Java, JSP, and Servlet are kinda new to me, as I didn't get Java at all in my college, so I don't know either what library is standard in JSP (already present, without I have to add it physically). I don't even know whether the Apache's StringEscapeUtils is present or not. Do you have any suggestion / codes on how I should escape the HTML characters under my circumstances? Thank you very much.
If your target platform is really Enfinity - as you are stating in your questions and in the tags - you should be using the Enfinity constructs even though this is not completely what you know from JSP. Please allow me to reopen this old thread and try to help you with that.
Enfinity got an own "templating language" called ISML. In the end ISML is precompiled to JSP. You can find a documentation with any installation of the Enfinity application server (a PDF called enfsuite_dev_programming). You should ask your project manager or build engineer if you don't have it available.
On the other hand I read from your statement that you possibly have the Enfinity Studio available (which is the IDE of Enfinity - a derivate of Eclipse. You should be able to access the developer guide through Enfinity Studios Help Menu. This menu may have some errors in some versions of the Studio unfortunately. However, you can get there through Window > Show View > Other > Help. On bottom of the help window is a "Content" link that will take you to the overview. The developer guide is under the table of contents link Enfinity Suite Application Programming Guide.
However you get to the guide: in the appendix you find a section "Reference > ISML Tags / ISML Functions / ISML Modules". Browsing through it you will find the function:
<isprint value="#value#" encoding="on|off">
Encoding is "on" by default and this statement will do exactly what you need: it will encode all HTML special characters in #value#. The special here is that the key value matches to an object in the so called Pipeline Dictionary which is a construct storing objects coming out of the Enfinity business logic workflow layer (so called pipelines).
This pipeline dictionary can be manipulated in JSP using:
Map<String, Object> pdict = getPipelineDictionary();
The dictionary is a standard java Map and can be manipulated using the known operations. However, the preferred way would be using pipelines or at least the respective ISML tag
<isset name="name" value="#value#" scope="request|session">
A full example for usage with JSP/ISML would be:
<%
String myString = "<b>Test</b>";
getPipelineDictionary().put("myDictKey", myString);
%>
<isprint value="#myDictKey#">
You can import org.apache.commons.lang.StringEscapeUtils and add its jar file. That are not by default present in jsp/servlets. It will provide you facility to escape characters from html, mysql, xml etc. Also you can make your own method to check for the character sequence and then use it as a escape function to escape data you want.
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 found that Liferay transfers my JSP code in a somehow "condensed" way -- putting most of the text into a few very long lines.
This makes it uncomfortable to debug javascript.
Is it possible to turn off this feature temporary?
For others looking at this post, if you simply want to do this on an adhoc basis you can add these params to the URL:
/web/guest/page?js_fast_load=0&css_fast_load=0&strip=0
Note this is for JS, CSS and HTML
HTML Minification is on regardless you're in developer mode or not since HTML stripping can itself produce problems you want to see in developer mode.
You can add strip=0 parameter to the URL to prevent the served HTML page being stripped.
In order to turn HTML-Stripping completely off change in your system.properties:
com.liferay.filters.strip.StripFilter=false
But as #BalusC said you should use a tool which does the formatting when debugging. So you're not bothered by the stripping.
There are two ways to do it. Copy the following in portal-ext.properties and restart the server
javascript.fast.load=false
or If you dont want to restart and its just for temporary purpose add js_fast_load parameter to url and set its value to false.
For example if you are in a page http://localhost:8080/web/guest/home in which your portlet or the javascript is present. Use this url instead http://localhost:8080/web/guest/home?js_fast_load=0
Liferay has a file named portal-developer.properties as template in WEB-INF/classes. You can either reference this or just copy/paste the content into your portal-ext.properties.
This has several options to minify html, js, css and others. You'll kill your loading time - i.e. you really only want these options at development time, but then it really helps.
By default all files are also combined into a single one (for js, another for css etc.) - with the development options you'll get a separate request for every file on every page request.
I just want to update package name for Liferay 6.2 from #Fabian Barney's answer:
com.liferay.portal.servlet.filters.strip.StripFilter=false
You may all have seen online content management systems or publishing platforms, where one can edit a page, but for convenience, the editing is not done in the browser, but instead in Microsoft Word. So whenever you open the page to edit it, the current page is send to MS Word and after completing the editing, Word sends back the page to the server.
A good example is Confluence. Instead of using the built-in WYSIWYG editor, you can also edit a page in MS Word.
How does this work technically? I want to program something similar on a Java servlet based web app. The first part is easy. I convert my page into the format of the external application and send it to the browser setting the correct mimetype. The external application will open the document. But I have no idea how the second part works. How does this application sends the file back?
Please send me any pointers you might have. My main problem is probably that I really don't know what I should search for. Also, if you know any opensource Java based projects doing something similar, I would like to study them to get started.
PS: Please feel free to change the title of this question!
One way this works is if you start Microsoft Word not wih a file as an argument, but witha n http/https URL that points to a WebDAV-supporting location. In this case Word will send the file bach witha PUT method when saving.