I want to hide the xhtml page name when redirecting, url should be user defined. For All redirecting pages the URL should be same only the content of the page should be changed. how i need to implement this in primefaces without using third party tool like pretty faces.
First of all, what you are talking about is not URL rewriting.
By 'URL Rewriting' we mean to show more user friendly URL instead the one your page already have.
If what you want to achieve is to have only one URL for all of your pages, maybe your should use ui:include with rendered tag for every page in your home page and keep your page name in session scoped bean, which is BAD idea and NOT a good practice.
More of this is explained here:
How to include another XHTML in XHTML using JSF 2.0 Facelets?
and what you need to add is this:
<ui:include src=".../PageOne.xhtml" rendered="#{mySessionBean.pageToShow.equalsIgnoreCase('PageOne')}" >
Anyway I don't really see any security based reason why would you need to do this. Maybe you are looking for an answer in a wrong direction.
I will let you decide if you need this or not.
Related
I'm trying to create a CSS documentation library in Orchard. I want to save a description, CSS snippet and HTML snippet against each content type. The first view would show the description and CSS and HTML code written out. The second view would show a preview of what the CSS and HTML look like rendered.
cssdocumentation.com/content/item1
cssdocumentation.com/content/item1/live-preview
I've created the content type and the first view. But I'm not sure how to create the second view. I can see if I can create the alternative URL I can use the Url Alternates module to create an overriding .cshtml
To create an alternative URL I've looked at the autoroute module but this only allows you to adapt a single URL (unless I'm missing something?) and I've looked at Alias UI but this forces me to manually create an alternative URL everytime I create a content item.
Is this possible in Orchard without writting too much C#? (I'm a frontend developer so I only dabble in the behind the scenes stuff)
Thanks for any help
Best solution is to do this within your own module. But as a secondary option instead of having a second page, combine this content with your first page and hide it with CSS. When the user clicks a button to navigate to the next step render the CSS/HTML result on the same page. You can do this in many ways, here are a few ideas:
Render the CSS/HTML result out straight away on the same page but hide it. Show it when the user clicks a button
using jQuery to render the result on the client side. More dynamic if you allow editing of the HTML and CSS.
Redirecting the user to the same page with specific url parameters which you can pick up in your alternate to modify the output.
I want to mask my JSF urls, to customization purpose.
For Example:
If url is : http://localhost:8080/myapp/mypages/index.xhtml
I want to mask it as : http://localhost:8080/MyApp/Home
I want do like this for all urls of my application.
I'm sorry If this is repeated question,! If there is any similar on JSF question please point it out I'll delete this question.
I am using urlrewriting and my pattern matches ../products/product_id and maps to /product.jsf?product_id=$1.
The rewriting performs well, but I am having trouble generating dynamic links.
In a context of iteration:
...
<h:link value="view product" outcome="products/#{item.id}"/>
...
The case is very simple. I just want the url generated has the form "products/123", but the page doesn't render, I guess because the outcome cannot be resolved at generation time.
I could just generate a link with "/product.jsf" and add a view parameter. But I prefer the other way. How can I have this behavior?
If you don't have a valid navigation case outcome, just use plain HTML <a>.
view product
Depending on the current URI, you may only need to prepend the context path yourself.
view product
in the upper left corner of my app there is a logo. After I click on it I would like to be redirecterd to home page wherever I am now.
Of course I could just link it www.myhomepage.com but that is not very nice and scalable.
I could link it to action="../spring/main-flow" but that is not good either.
How should I do this properly?
Thanks in advance
Link to the context path directly:
...
Or when you're still using old fashioned JSP as view technology:
...
Works also in combination with <h:outputLink>.
Or use the new JSF2 <h:link>, if you have for example a index.xhtml, it will prepend the context path automatically:
<h:link outcome="/index">...</h:link>
Anything other than / seems overly complicated, unless different sub domains are involved.
This problem is the result of IE7 not displaying animated GIF's that are hidden.
for reference:
http://crunchlife.com/articles/2008/06/11/ie7s-inanimate-gif
These 2 solutions involve the use of the setTimeout function and innerHTML. These examples use absolute URL's to the images. Since I'm using JSF, I would like to use relative URL's. Is there a proper way to do this in JSF?
Those examples doesn't use absolute URL's. Your problem lies somewhere else. At least, the URL pointing to the image should be relative to the request URL of the JSF page in question. You can easily check it in the browser's address bar.
A common mistake among starters is namely that they think that it should be relative to the location of the page in the server side folder structure. This is untrue. You should look at the request URL. Determine the absolute request URL of both the JSF page and the image, then you should be able to extract the relative URL to the image from it.