Android using java servlets from an existing web application -
I have an existing and working Java web application. I want to make this application native on Android and using the same servicelet Want to continue
The last time I was doing an Android application that was communicating with the server, there was something like this in the servlet:
PrintWriter out = response GetWriter (); Out.print ("passed");
And in the Android Java class I will do this:
string response = null; Try {response = CustomHttpClient.executeHttpPost ("http://10.0.2.2/ProjectName/" + "LoginSiterve", Postpartum); String rays = response.toString (); If (res.equals ("pass") {/ I want to do things}}} hold (exception e) {e.printStackTrace ();}
servlets that That uses my epiphany in my web application and thus has a sending method:
http session session = request.getSession (); session.setAttribute ("user", user);
and this:
sending (request, response, "/login.jsp");
I PrintWriter has an existing servlet that my web application uses it fails And this error was generated on logcat:
07-12 08: 59: 46.344: E / JWWP (487):>> gt; & gt; & gt; JSP Comparison 'Ensures' to 07-12 08: 59: 46.454: E / JWWP (487):>>> JSP> 'NFO' 07-12 08: 59: 46.524: E / Jdwp (487):>>> jsp 'is compared to' O $ 1 '07-12 08:59: 46.534: E / JWWP (487):> gt; & gt; Jsp 'to' NFO '07-12 08:59: 46.534: E / JWWP (487): & gt; & Gt; & Gt; Comparison of 'JSP' 'O $ 1' 07-12 08: 59: 46.594: E / JWWP (487): & gt; & Gt; & Gt; Compare 'key' with 'JSP' 07-12 08: 59: 46.934: E / JWWP (487): & gt; & Gt; & Gt; 'See' comparison of 'JSP' 07-12 08: 59: 47.044: E / JWWP (487): & gt; & Gt; & Gt; Comparison of 'JSP' 'IL' 07-12 08: 59: 47.334: E / JWWP (487): & gt; & Gt; & Gt; To compare 'JSP' to 'genes' 07-12 08: 59: 47.334: E / JWWP (487): & gt; & Gt; & Gt; Comparing 'JSP' to 'NFO' 07-12 08: 59: 47.354: E / JWW (487): & gt; & Gt; & Gt; Comparing 'JSP' with 'AME' 07-12 08: 59: 47.404: E / JWWP (487): & gt; & Gt; & Gt; Comparison of 'jesp' to 'jeera' 07-12 08: 59: 47.404: E / JWWP (487): & gt; & Gt; & Gt; Comparing 'JSP' to 'AME' 07-12 08: 59: 47.504: E / JWWP (487): & gt; & Gt; & Gt; Comparing 'AMS' with 'JSP'
and the list to be compared is in progress.
Question: Am I forgetting something or should I just create a new servlet? (I hope this is not the second option)
edit
I have found that the dispatch method causes an error that changes the reaction Instead of just a text string, for a jsp file, and commenting to the transmission method, I get permission to successfully login to the server using Android.
However, I send the Sender Method and PrintWriter I would like to keep Also true way Android applications can access a single Srvislet for web application logging so I can do?
After some research, this question does not seem to answer. There is no way to use the same servicelet for web applications and Android apps. A new servlet can be made, no matter if 95% of the 2 servlet content is the same.
There are some ways in which I am currently aware that can be logged with Android:
1) Using the Outprint method in the above form. To create the printWriter object and use the object. Print, and check it by response.toString () Equal in Android Java Class ("Expected string").
2) Cookies, which I thought worked, but no, the transmission method has still got in the way. Whenever it comes to cookies, I am still unclear but apparently you can keep user information in the cookie so that the user can be authenticated during the application.
Feel free to add to the answer or correct me if I am wrong in any of the above.
Comments
Post a Comment