Unable to navigate if i keep the .xhtml files in sub folder(other than the root folder) in JSF 2.0 - jsf

I am new to JSF 2.0. I was practising the implementation of JSF 2.0. When i keep my A.xhtml file in the root folder and navigate to another B.xhtml file which is in subfolder in root folder, the page is navigating successfully. But when i am navigation from B.xhtml to any other file, it is showing page not found error. If i moved my B.xhtml file to the root folder , in this case i am able to navigate to another page.
Seems like it is with the problem of handling paths, when my .xhtml files are in sub folders other than directly in the root folder.
Please let me know where it is going wrong.
Your solution is greatly appreciated !!
Thanks,
Sai.

I got the answer. I placed the sub folder in WEB-INF folder. Instead if i moved the subfolders to WebConent folder., it is working.

Related

Unable to load GLTF file in ASP.NET View implementing A-FRAME

One of the views (.cshtml file) of my ASP.NET MVC application is using A-Frame. I am trying to load a 3-D model using GLTF file inside the <a-scene> tag.
<body>
<a-scene>
<a-assets timeout="5000">
<a-asset-item id="tree" src="~/Assets/scene.gltf">
</a-assets>
<a-gltf-model src="#tree"></a-gltf-model>
</a-scene>
</body>
I have already tested the src path in the same page by putting a .png file and loading it in <img/>, it works. The problem is just with the .gltf file.
What is possibly wrong with the .gltf file in particular?
The URL doesn't seem like a valid URL. It seems like a Unix path. Host the GLTF somewhere the website can reach it (like the same directory) and fix the path. src="scene.gltf".

Issue with h:form - Returning 404 when submitting through h:commandbutton

I am working on a JSF (2.2) application. I am seeing some weird behavior working with h:form and h:commandbutton.
Issue - I have following code in say searchRecord.xhtml -
<h:form>
<!-- Input fields -->
<h:commandbutton type="submit" value="Search" title="Search" action="#{bean.search}"/>
</h:form>
The issue I am facing is when I click on submit button, it shows 404-page not found with URL pointing to current page. It is not executing the specified bean action.
I tried to debug this. When the form is getting translated into HTML, the form is getting generated with method="post" action="/MyApplication/WEB-INF/searchRecord.xhtml" (which looks to be the correct behaviour). Still, on clicking the button, I am getting 404.
Can anyone please help me figuring out what is the issue? I wasted my weekend figuring this out but in vain.
EDIT -
IDE - Eclipse
JSF Version - Mojarra 2.2.8
Directory structure of my project is -
Project
- Java Resource
----src -> contains java files
- WebContent
---- META-INF
---- WEB-INF
------facelets -> contains *.xhtml files
------resources -> contains img, css and JS files in respective folders
------commonLayout.xhtml
- index.xhtml
I access my application using a launchHandler servlet which validates the request parameters and forward to searchRecord.xhtml.
I am able to see searchRecord.xhtml. but Now when I click , I am getting 404.
As a standard, we are required to use servlet and then forward accordingly.
I found solution for my problem. The issue here was the wrong directory structure (Somehow I missed the point that resources under /WEB-INF are not reachable by URL. Thanks to #BalusC for pointing this out!!!). Based on the answers on below post -
JSF files inside WEB-INF directory, how do I access them?
Which XHTML files do I need to put in /WEB-INF and which not?
I restructured my projects as follows -
My Application
|- Java Resource
|----src -> contains java files
|- WebContent
|---- META-INF
|---- Resources -> contains img, css and JS files in respective folders
|---- JSF
| |--Contains client .xhtml files
|---- WEB-INF
| |--template -> contains the master templates for my application
| |--web.xml
|---- index.xhtml
Now the navigation is happening as expected and all the pages are displayed.
I am also planning to use JSF 2.2 configuration parameter and put resources under WEB-INF.

does not display the result (Java)

Hello trying to figure out the Jsf (primefaces) and little that goes viz. Compiled war archive in maven try to run through the Glassfish, the server starts but in the beginning writing "Artifact qwe-1.0-SNAPSHOT.war: Server is not connected. Deploy is not available." But in the late writes "Artifact qwe-1.0-SNAPSHOT.war: Artifact is being deployed, please wait... Artifact is deployed successfully." It seems like everything is normal, then opened my page in the browser is empty although in my index.xhtm and my pom.xml and web.xml link pastebin
and should be a button with styles that are connected in primefaces tell me if I'm doing something wrong?
here's a screenshot of the result in the browser. link1
<p:button outcome="productDetail" value="Bookmark" icon="ui-icon-star"> targets you to the productDetail page. If you do not have productDetail.xhtml page at the currect path, the index.xhtml page cannot resolve NavigationCase for outcome. Thus, Create page productDetail.xhtml and put into the same directory of index.xhtml.
In addition, You should use JSF Standard tags(h:head, h:body).

Liferay success message for uploading a file

I'm trying to add my own success message on liferay after uploading a file.
in my view.jsp:
<liferay-ui:success key="key1" message="message1" />
I created a package in src folder named: "content". in whish I created a file: language.properties.
language.properties:
message1=file uploaded successfully
in my controller:
SessionMessages.add(uploadRequest, "key1");
but that doesn't work. it display the liferay default message. please help.
It seems you have not specified resource-bundle entry in portlet.xml.
In portlet.xml provide <resource-bundle>content.language</resource-bundle>

include file directive not working in linux sever

My problem is, i have included a page using the code
<%#include file="../include/dbconnection.jsp"%>
My page resides in a sub directory of public_html but when i load my page it shows the following exception
org.apache.jasper.JasperException: /index.jsp(23,1) File "/../include/dbconnection.jsp" not found
But this code works fine in my development system(which is windows) i use a linux server for my website. Is this a problem with file separator or file permission issues? what could be the problem?
You can find your answer in the post below which is using <jsp:include page="..."> , the <%#include only works with static references.
Is it possible to have a dynamic path as part of a jsp include

Resources