In my application (CMS for internal purposes) I'm facing the problem how to serve pages stored in the database with dynamic URL (e.g. http://example.com/page3) using the JSF. Generally, let's say I want to grab the page content from the database, put it inside jsf file and serve it as /page3. Is there any way how to obtain the request URL from JSF, search the database for the article (instead of searching *xhtml in the WAR), build dynamically the JSF XHML file and return it to JSF as InputStream for example? I've found this answed by Thomas Maerz, but it failed with
Unable to create a new instance of 'com.test.CustomResourceResolver': java.lang.InstantiationException: com.test.CustomResourceResolver
on my glassfish v4 (Mojarra 2.2), and I also found that ResourceResolver is deprecated in JSF2.2.
I've googled a lot, but this seems to be not very common/documented part of JSF.
Thank you for any help.
I did not understand fully the problem, but for url change you can use prettyfaces, for dynamic forms you can use primefaces ext and I am not suggest keep form in the database, if I know your target I can suggest more useful answer.
Related
I am working on integrating a 2sxc content WebAPI feed into a ReactJS application.
I have managed to get a JSON feed of data into the application, and am in the process of mapping out the data.
I'm wondering what the best practice would be to "resolve" a URL which is coming through as a DNN Page/ Tab ID.
Below I will showcase the various points this is referenced...
First the Setup of the entity / data types...
Then this is an example entry with the data filled out... The page link / URL is set up to point to another internal page on the DNN website:
Finally you can see this data item come through as a JSON feed via the 2sxc API:
What is the best way to convert this piece of data into a URL which can be used in a SPA type application?
There isn't any "server-side" code going on, just reading a JSON feed on the client side...
My initial idea would be to parse this piece of data in JS, to extract the number then use something like this:
http://www.dotnetnuke.com/tabid/85/default.aspx
http://www.dotnetnuke.com/default.aspx?tabid=85
I was hoping someone with more experience would be able to suggest a better / cleaner approach.
Thanks in advance
If you were server-side in Razor you'd be doing something like this:
#using DotNetNuke.Common
View List
XXXX = Dnn.Tab.TabID or define a string with the tab id you want
I seem to have a vague memory that I saw somewhere that Daniel (2sxc) has a way to use Globals.NavigateUrl() or similar on the client side, but I have no idea where or if I did see that.
The Default.aspx?tabid=xx format will certainly work, as it's the oldest DNN convention and is still used in fallbacks. The urls aren't nice, but it's ok.
The reason you're seeing this is because the query doesn't perform the automatic lookup with the AsDynamic(...) does for you. There is an endpoint to look them up, but they are not official, so they could change and therefor I don't want to suggest that you use them.
So if you really want a nicer url, you should either see if DNN has a REST API for this, or you could create a small own 2sxc-api endpoint (in the api folder) just to look that up, then using the NavigateURL. Would be cool if you shared your work.
I currently have an existing Preact JS site set up but want to add blog section.
So basically easy way to add new pages and routes.
I.e. blog/content-1, blog/content-2
I know I could easily create these pages and routes manually but is there something better out there that fits into existing sites ?
I.e. a lot of the static site generators I see out there, basically you need to run from the start and they generate a new site.
But in my case I just wish to add an extra section to my site which will be the static blog entries, not sure what the best tools out there for this is ?
If any ideas or suggestions would be great.
The preactjs.com website is built exactly how you are wanting to build this. It's open source: https://github.com/developit/preact-www
Basically, fetch your HTML content via Ajax (however you'd like), then render.it as Virtual DOM using preact-markup.
For a real-world example, here's how preactjs.com does that:
https://github.com/developit/preact-www/blob/master/src/components/content-region.js
Starting with a website build with AngularJS as frontend and a ReST API set as backend. I would like to append an online help content.
Does exist a project or a framework to do that quickly (using angularjs powerfull) ?
I have no special mandatory requirements. I think that two concept could be important:
help section representation as a tree,
quick link between webapplication and online help.
JHipser may be the one you need.
I finally decided to build it without additional framework:
a flat json file that describe the structure and contents of my online help,
a controller with $http.get(...) embedded to get back the content
a dedicated help page : I re-use the bootstrap help menu and I use the ng-repeat directive to show the active content.
(Anyway Thanks #Shaojiang Cai for your suggest).
I'm attempting to configure URL routing in my ASP.NET 3.5 WebForms app. Setting up routes has always been confusing to me, so I was hoping I could get some direction.
My requirement is fairly simple. I'm setting up different "brands" of my application, and I'd like the brand to be specified in the URL. For example, http://www.mysite.com/brand1/Default.aspx would bring up one brand (code behind would look up brand1 in the db and load specific text, images, themes, etc) and http://www.mysite.com/brand2/Default.aspx would bring up another brand, etc.
I'm fairly flexible with how the URLs are displayed, with the exception of keeping the http://www.mysite.com/brand1 prefix. That cannot be changed.
Thanks for any help!
I do this by using http://www.UrlRewriter.net, as explained here by Scott Gu:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
The trick is to use URL rewriting rules (Regular Expressions) in your web.conifg to get a request for /brand1/default.aspx to actually execute /Processor/Default.aspx?brand=brand1, for example.
NB: The Form.browser trick worked a treat for me when doing postbacks.
Another possible answer from me...
If you're using IIS 7 there is a handy built in module for URL Rewiring, all controlled through a GUI if that's your preference:
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/
I am running a website using PHP/MySQL. Now I want to allow Blogs using wordpress in my website so I can use Google Adsense along with blog content. I have installed Wordpress on my site, using tools provided by host service provider.
Now is there anyway I can import selective-content from MySQL database to these wordpress blogs? If so, how?
Thanks.
Short answer: maybe.
It all depends on how the content in your existing MySQL database was structured. If the old content was created by a content management system, see if it has a built-in exporter. WordPress has plug-ins that can import from a variety of commonly-used CMS platforms already. Check to see if yours is supported.
Unfortunately, if your content was just kind of "there" in the database without a CMS or any kind of standard (non-custom) structure, then this won't really work. My recommendation would be to use phpMyAdmin to export your content, then use a text editor to cut out the portions you want to keep and manually create new blog posts within WordPress. This process will be very time consuming but can be optimized if you want to build a custom importer.
Yes you can import/export your contents from/to other site respectively using following ways
Using Plugins like duplicator etc
Using the existing WordPress tools availabe in the Dashboard/Admin section like Import & Export
There may be other different methods also available on the internet.