$(function() {
$("#ac1").autocomplete('getdata.jsp');
}
I'm calling that page in liferay6..
so, What sort of changes I will have to make in portlet.xml and another file ..
I'm getting this error....
http://localhost:8080/web/guest/getdata.jsp?q=abc 404 Not Found
(This error is coming in Firebug not in UI)
Thanks in Advance,
Mayur Patel
First of all, if you are using a portlet specific resource as the data, you should probably be using portlet:resourceURL or liferay-portlet:resourceURL instead of a static address to the file getdata.jsp. ResourceURLs create fully qualified URLs that target your own portlet. The resource served are supposed to be content fragments instead of full blown pages. That way they are especially suitable for AJAX-calls.
Where is the getdata.jsp file located? You could define the full path to the file i.e. /my-service/getdata.jsp instead of relying on the relative address that points to the /web/guest url-mapping. That way you can be sure that the file is found provided that you are not going to share the portlet with others that might not install the portlet the same way as you have done.
Related
I am new to net beans and JSP. I created index.jsp in Web Pages folder and i want to link a text in index.jps to another JSP called CompanyLogin.jsp in Web Pages/MainLogins/ComapanyLogins/CompanyLogin.jsp.
I tried <li>Company</li>
but it didn't work. Plese tell me hoe to solve this problem. Thank you for any help
The slash at the URL's beginning makes it absolute to your host. But usually the first part of the path is the context name. It's safest to use a relative path like
Company
Here relative means relative to the location of index.jsp.
I have a spring boot application where I serve some static jsp pages stored in directory src/main/webapp which includes some javascript references stored under directory "src/main/resources/static". When I do the requestmapping for "/somepath" then it successfully returns view that has javascript references in static resources folder such as "src/main/resources/static/lib/script.js"
But the problem that I'm facing right now is when I do the #requestmapping to "/sompath/xyz" then I get HTTP 404 error. When I inspected the page source then I found out that the page was searching for static folder in this path "/somepath/lib/script.js" that is "/somepath" is getting prefixed to the default resources location. Is there any way that I could map these URIs such that no matter how many "/path/" are there, it will look for resources under the "/static/" folder only and not like "/static/path"
Any help is appreciated. I apologise for my problem structure as I'm a beginner and I'm still learning to put all these things in better perspective. Thanks in advance.
I have same problem I found the way but its half solution.
first
use RequestMapping path depth just one like 'spring'
It is work well every situation.
second
use RequestMapping path depth tow like 'spring/xyz' and <link src="../some.css"/>
last
use depth 3 'spring/xyz/123' and <link src="../../some.css"/>
This all is messed up but it is working.
So I open the question on stack overflow again here please anyone come and check this and leave some idea thanks~!
I am getting Error 404 when trying to run my application.
Tomcat server, start and synchronized. Dynamic module version is 2.5.
Previously I used dynamic module version 3.o but it didn't work. I read in
one of the posts that better is to use 2.5. so I created new project and
still get this 4044 error. It is technical error I think.
I needed to create index.jsp WebContent->New->JSP file and it will place it in the right spot. Now I am able to see my index page.
The problem was that I created index.jsp file WEB-INF->New->JSP file. You can see it above in my post.
Here I place the image where you can see image.jsp is place in different spot. You can see small difference.
That's why I asked you to create a test dynamic project to compare. I think when you created that new project you placed index.html under WebContent correctly. So you couldn't figure out with that example.
Also you can place your jsp inside WEB-INF. That's a recommended way too to keep it safe . I mean if the file is inside WebContent a Web user can navigate to the location and access it. But if it is inside WEB-INF the access is controlled by your web.xml.
So in your former case just give the relative path .ie /WEB-INF/page.jsp
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
in eclipse IDE how can i access a java class from .jsp
exactly like accessing a servlet from a jsp file ?
in other word, what should i replace with question marks "????????"
<form name="myForm" action="???????????????" method="post">
</form>
when i run engine.java file from "mypackage" package tomcat application servers shows this address in the address bar.
http://localhost:8080/rouyesh/servlet/mypackage.engine
anybody can help please?
You'll need to use whatever the path relative to your current URL is, or the absolute path, just as you would with files. It might be prudent at this point to investigate a web framework, however, before you destroy your product with insanity :P.
If you just need to call the class from your JSP page, then just do it.
If you need to expose your class through an URL, the standard way to do so, is to enter through a servlet (exposed in the usual way) and call the class inside the servlet.
Your particular framework may provide such functionality out of the box. Read the documentation carefully.