How to detect if the phone is now supporting xhtml or wml?
I'm creating a wap application. Since some of the phone only support wml, I have created 2 sets of wap pages with their files separated in 2 subfolders.
Therefore when a wap user access/enter my wap apps, my apps should be able to auto-detect the user's phone supported-language and make an auto redirect so that the user can see the proper page.
How to detect the capability to display xhtml by checking the accept header of the client by type 'application/xhtml+xml' ? Please show me some example on how to?
FYI, All my pages are in jsp and save in .jsp file type.
Anyway is it needed to build 2 sets of code of xhtml and wml tag for the same apps? I just do not see much difference when i tested my pages in the nokia 3300 SDK. Is form-posting supported in wml pages?
can't give no real-life examples, 'cause i didn't do it yet using jsp.
but like other languages java provides means to access the http header of a http-request.
the request is sent from a wap/xhtml browser, which tells the server what type of content it understands by sending a accept header. so the browser says 'i'm capable of displaying content types like...'.
Now what u do serverside is examine the http header, specifically the 'accept' section. if it got the string 'xhtml' in it, you route to the xhtml file, if i doesn'n contain 'xhtml', route to the wml file.
yes you have to do to sets of pages ( unless you use a sophisticated transcoding mechanism to automatically render pages upon a xml basis...this involves serverside XSLT )
that's because wml and (x)html are quite different in document organization and features. if u want to take advantage of the xhtml features, u must tell the client ( and the gateway ) exactly what content-type to expect.
so make sure you send a header containing the right mime-type like "Content-type: application/xhtml+xml"
in your jsp files.