• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GET and POST in J2ME using JSP

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello....

i'm new beginner for J2ME...so i would like to ask whether we can use JSP to GET and POST in J2ME...
I have try some coding but it not working...
i also try to get data from sql using jsp through J2Me but is have some error..
s0 it is possible we can use jsp to get and post in j2me..
or maybe you can give me some simple example GET and POST in J2ME using JSP.....

i really appreciate your help....

Thank you...
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I may be misunderstanding what you're trying to do, but you can't use a JSP "in JME" (it hasn't been J2ME for years). JSPs are a server-side web technology, and you wouldn't run a servlet container in a JME environment.

What is perfectly possible is that a JME app would send an HTTP request to a servlet container which is handled by a JSP. Generally, you wouldn't address the JSP directly, though, but go through a servlet or some other kind of "handler" or "action" component, which then in turn uses a JSP.

The fact that you got "some error" doesn't mean that it isn't possibly - it simply means that you have a bug in there somewhere. If you told us what error that is, specifically, and what you're trying to do, exactly, we might be able to help.
 
Intan Syafiqah
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your answer..there is my coding..
i'm try to request my username and password using JSP handler...
but when i try to pass airtime in midlet i can't....
i hope you can solve my problem.....

here is LoginTest.java (midlet)



here is my jsp coding (indexDB.jsp)
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Intan Syafiqah wrote:but when i try to pass airtime in midlet i can't....


Why not? What, exactly, are you trying to do, and what, exactly, is the result? There seems to be code that makes an HTTP call, but it's not clear whether that code is being called, or if there are any exceptions if it is in fact called. Those are the details we'd need to know in order to help you.

It's also not clear whether the JSP is ever accessed, or -if it is- what the result of that is. Note that the practice of embedding Java code in JSPs has been considered bad practice for a decade. That's no way to implement a mobile solution. You should think about this in terms of REST, with no JSP being involved at all.
 
Intan Syafiqah
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your information...

What I'm try to do is i try to log in to database through JSP handler..
and I'm try to get the username and password at J2ME and compare it in database mySQL through JSP handler..
it is my J2ME coding is wrong or my JSP handler coding wrong??

if you have any example to log in J2ME interface through JSP handler with mySQL database..
please let me know..i really need your help...
and i really appreciate it..
Thank you..
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I meant is: What happens if you run this code? Is the HTTP call actually being made? Note that I'm not asking if you think it should be made - I'm asking if you have verified in some way that it is actually being made.

Assuming that it is made, what is the result on the server side? Which parts of the JSP or are not being executed? How does that differ from what you thought would happen?

Also note that the DB code in the JSP is wide open to SQL injection attacks; you need to fix that before using this in a production setting. At the least, use a PreparedStatement.
 
Intan Syafiqah
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the error went i try to pass airtime...

Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.

i don't know what the error..
It is there have some error on my method commandAction handler....
i really confuse on that method...

please help me....
i really appreciate your help...
Thank you...
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off, that's a warning, not an error.

Go through these two pages: Networking, User Experience, and Threads and Using Threads in J2ME Applications
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic