HTML pages in EE

Hi,

When I ask a question I receive the following address in the address bar:

http://www.experts-exchange.com/Web/askQuestion.jsp

After submitting the question,  the Address in the Address bar becomes something like this:

http://www.experts-exchange.com/Web/Q_21221424.html

This is a database driven website.  When I submit using askQuestion.jsp it goes to a database,  probably Oracle.  Then question becomes an .html page instead of
Q_21221424.jsp.

How is that done.  Submit a form using JSP then view the question in HTML,  also the question has a number.

Thank you



LVL 14
hhammashAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

riyasjefCommented:
Hi

For each question, seperate HTML page must be generated..Otherwise I do not think google can search the questions ..

RJ
StormyWatersCommented:
They might have configured their webserver to parse
Q_21221680.html

into queryquestion.jsp?q=21221680

Or whatever.

hhammashAuthor Commented:
Hi RJ,

Thank you for your reply.

Each form will generate an HTML page with question ID.  But,  when you reply to a subject,  you add to the HTML page,  how is this done?

The HTML page itself is divided into the asker name and the persons who reply.  How is that done.  Is it limited to JSP or it can be done via ASP and PHP?

Thanks
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

humeniukCommented:
It can also be done in ASP or PHP and there are a few ways to do it.  One way is to use the Apache mod_rewrite module.  Here's a tutorial that shows you how to do it: www.phpfreaks.com/tutorials/23/0.php.  More details can be found in Apache's URL Rewriting Guide (http://httpd.apache.org/docs/misc/rewriteguide.html).  Here's an IIS/ASP trick using IIS's custom error messages - www.asp101.com/articles/wayne/extendingnames/default.asp.  Another IIS option is to use an ISAPI filter like ISAPI Write (www.isapirewrite.com), which is closer to the Apache mod_rewrite solution.

<< I do not think google can search the questions >>
To clarify, Google and any other major search engine can crawl and index dynamic pages, but "it helps to keep the parameters short and the number of them small" (according the Google's Webmaster Guidelines - www.google.com/webmasters/guidelines.html).  What this means is that if you use something like www.experts-exchange.com/Web/question.jsp?qid=21221680, you're probably ok, whereas if you use something like .../question.jsp?category=web_development&asker=hhammash&other_stuff=very_important&more=info, you're looking for trouble.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PaulPositionCommented:
On Apache servers at least (and probably others too), there is a method called 'Mod Rewrite' that allows you to parse static looking URLs into parameters. Thus you could have a page that, really, is mypage.php?year=2004&month=10&day=30 but is accessable as .../mypage/2004/10/30

A few pointers :

Apache's  Mod Rewrite :
 http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

Some alternatives for different server...:
 IIS ReWrite (http://www.qwerksoft.com/products/iisrewrite)
 ISAPI ReWrite (http://www.isapirewrite.com).

Good luck :)
humeniukCommented:
Just noticed that my Apache's URL Rewriting Guide link is for Apache 1.3 and PaulPosition's is Apache 2.0.  I think the document is the same, but you probably want to use the 2.0 one just in case (if you're using Apache 2.0 and go that route).
hhammashAuthor Commented:
Thank you for your detailed replies,  I'll take a look at the tutorials.

There is still a part to my question.  When you reply to my post,  it adds to this HTML page.  Is it also by rewriting and giving an anchor to it?

Thanks
humeniukCommented:
The content of the page is dynamic.  When I submit this reply it will be added to the E-E database.  When you request this page, the E-E server will generate this page using the question id (21221680) to populate the page with your question and subsequent comments (including this one).

Each comment is given an anchor, ie. your last comment was #12686471 (hence www.experts-exchange.com/Web/Q_21221680.html#12686471), but that is only for identification/navigation purposes.  The page could be populated without the anchor.

The URL will then be rewritten from whatever its dynamic form is ie. .../question.jsp?qid=21221680 to it's current form .../Q_21221680.html using the mod_rewrite (I presume since E-E is hosted on Apache servers).
COBOLdinosaurCommented:
With the exception of a few static text pages, there are no HTML pages on the server.  All pages are generated from queries and page generation using jsp.  The tomcat app servers are just a collection of servlets, the apache parse and creates the arbitrary url.  It also decodes the links sent, because the only part that it needs to pass to the backend is the Q number.

Try this: the link for this question is:

http://www.experts-exchange.com/Web/Q_21221680.html
put it in your address bar as:
http://www.experts-exchange.com/javascript/Q_21221680.html
it will still find it.  Is the page in multiple directories?  No it does not exist until the app server creates it, and the web server just adds the navigation as if they were directories.

This kind of setup is not at all unusual.  You will not find many modern large sites where they have a lot of static pages.  Almost everything today is generated on demand.

Cd&
hhammashAuthor Commented:
Hi,

Thank you all for the answers.

COBOLdinosaur,

Yes I've seen these pages even in ASP forums.

Yes the Javascript link worked.

Does this mean that this html page Q_21221680 does not exist?  Whenever we call it it gets generated?

Thanks
humeniukCommented:
"Does this mean that this html page Q_21221680 does not exist?  Whenever we call it it gets generated?"
Right, it doesn't exist on the server in this form, but when you use the simplified URL www.experts-exchange.com/Web/Q_21221680.html, it is able to interpret what you mean, create the page, and send it to you.
hhammashAuthor Commented:
Nice procedure.

Final question:

- What is the purpose of generating HTML pages while we can simply have .jsp, .asp or .php?


Thank you
humeniukCommented:
"Nice procedure."
Yes, very handy.

One reason touched on above is to make a URL more search engine friendly.  As noted, the major search engines can crawl and index dynamic page URL's up to a point.  Another reason is to simplify things for the website users.  I'm sure you've seen some wild and extremely long dynamic URL's on the web.  This process makes it much easier for us to use, remember, link to, and share these pages.  And in web development, ease of use is extremely important.
hhammashAuthor Commented:
Thank you
hhammashAuthor Commented:
For persons who are interested in doing the same thing using ASP.  Here is a good tutorial.

http://www.codetoad.com/asp_dynamic_static.asp

Thanks
COBOLdinosaurCommented:
Glad we could help.  Thanks for the A. :^)

Cd&
humeniukCommented:
Glad to be able to help out.  Thanks for the A.
hhammashAuthor Commented:
You are welcome,  thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.