Hi
i want to show a wap website on Java ME application but i dont know how !!!
please help me to do it
thanks

Dani AI

Generated

A short practical summary that builds on what and already covered and gives concrete next steps.

The simplest, widest‑compatibility approach is to hand the URL to the phone’s native browser with MIDlet.platformRequest(...). Call it from your MIDlet and check the boolean return — many devices return true to indicate the MIDlet should exit so the platform can handle the request. Example:

try {
    boolean mustExit = platformRequest("http://your-wap-site.example/");
    if (mustExit) {
        notifyDestroyed(); // let the platform launch the browser
    }
} catch (ConnectionNotFoundException e) {
    // no browser / network problem — fall back or show an error
}

If you need the content inside the app (no external browser), fetch it yourself and render it. MIDP provides Connector.open(...) and HttpConnection to download the WAP/WML page. Read the stream into a String, detect whether it’s WML (look for <wml or XML prolog), and either write a tiny WML->text renderer or, better, change the server to return a device‑friendly format (plain text, very small HTML/XHTML Basic, or JSON) that the MIDlet can display with standard LCDUI controls. Basic fetch example:

HttpConnection conn = (HttpConnection) Connector.open(url);
InputStream in = conn.openInputStream();
// read into buffer, convert to String, then parse or display
in.close();
conn.close();

Last option: use vendor APIs when available. Some handset SDKs (BlackBerry, certain Nokia APIs) provide an embeddable browser component — that avoids reinventing rendering but is device‑specific. Troubleshooting tips: test on real handsets (emulators differ), watch for permission prompts or required signing, and avoid trying to fully implement an HTML/WML engine on low‑end phones — server adaptation is usually the most practical route.

Recommended Answers

All 5 Replies

Hi
i want to show a wap website on Java ME application but i dont know how !!!
please help me to do it
thanks

You would have to read returned document as a schema(like xml), and through rendering engine provide necessary layout and set up for each wap tag therefore creating new mobile browser and in doing so reinventing wheel which will take very-very long

this is not my goal that create a browser , i want to show my wap web site on mobile application

Good luck to you...
As I said there are only two options
A) Use mobile browser like Opera
B) Create your own browser
C) Doesn't exist in what you trying to do....

i do it with platformRequest() method :)

Well you better read documentation properly because

If the platform has the appropriate capabilities and resources available, it SHOULD bring the appropriate application to the foreground and let the user interact with the content, while keeping the MIDlet suite running in the background.

Meaning if mobile device has any mobile browser that will be used

If the platform does not have appropriate capabilities or resources available, it MAY wait to handle the URL request until after the MIDlet suite exits.

Will do nothing if not available therefore you will not be able to handle WAP.

For the future make sure you are clear on what you trying to achieve as the above discussion prove you haven't been and just stumbled on a resource which you believed solved your problem, which in reality highlighted limitation you stand against.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.