I am trying to pass a text from the spinner. Actually the spinner contains the textx which I have fetched from the server side of my application.
So what I am trying to do is that, as soon as I select text from the spinner, I want that string to be passed to the server side. So here i am passing the text to a function which can make a request to the JSP.
Main part of the code(android)
categ = ((TextView) selectedItemView).getText().toString();
postData(categ);
//Remaining section
public void postData(categ)
{
String page="processing_pages/individual_phone_communicator.jsp?rom="+categ;
result = ws.getWebData(page);
if (result != null)
plotData();
else
alerter("null");
}
(It is returning a null value always.But when i am directly running the same query without any parameter and taking the value directly at the JSP page, it shows result)
Now it will move to the JSP.
String hk=request.getParameter("rom");
Now i am running a query like this:
sqlstatem="select first_name,latitude,longitude from tbluserdetails where user_id=(select user_id from tblindividual_job where jcat_id=(select jcat_id from tbljobcat where job_name='"+hk+"'))";
I am expecting it to give back data in the form of json array. But instead it is showing an error. I tried entering the parameter directly from browser even. Sometimes, the page is displaying correct answer with above query. This makes me more confusing. But when i tried with numbers such as 1 or 2 from the eclipse:
String page="processing_pages/individual_phone_communicator.jsp?rom=2"
and modified the query by trying the exact word instead of 'hk' like this
int rom=Integer.parseInt(request.getParameter("romo"));
if(rom==1)
{
sqlstatem="select first_name,latitude,longitude from tbluserdetails";
}
else
{
sqlstatem="select first_name,latitude,longitude from tbluserdetails where user_id=(select user_id from tblindividual_job where jcat_id=(select jcat_id from tbljobcat where job_name='Blood donar'))";
}
it is running correctly. From browser also, it is running correctly when i pass integer as parameter. But i need it to be running by taking a text from the emulator as parameter.
But when I try, like this:
String page="processing_pages/individual_phone_communicator.jsp?rom=Blood donor"
Then also i am getting null as result. What I assume is that, my JSP page is only taking integer parameters, I don't know why it is happening.
I am using net beans for JSP. Kindly find me a solution for this issue. Kindly ignore if the question is childish, as i am just a beginner.
I don't know what the "ws" variable is, but the IP for your local machine (not the phone) in the android emulator is 10.0.2.2. So any URL pointing to a local web app on your machine should start with http://10.0.2.2/...
Mike
Related
Using Flutter I have a form that contains an AutoCompleteTextField, I am trying to get changing of the value of the text field working. The value to be edited is placed into the AutoCompleteTextField when the form is opened using the technique linked to my previous question:
How to set the initial value of Flutter autocomplete_textfield
Now I find that if I try to change the value of the field the autocompletion appears to work, but the new text does not appear in the form data when the form is submitted, the previous entry remains. I have tried adding the new text to the form data but this does not change the behavior.
The "itemSubmitted" code looks like:
itemSubmitted: (species) {
setState(() {
searchTextField.textField.controller.text = species.commonName;
});
The submit method calls validate and save on the form data:
if (_formKey.currentState.validate() == false) {
return;
}
_formKey.currentState.save();
What more do I need to do to get the new selection in the AutoCOmpleteTextField updated in the firm data?
Update:
It appears that if I start with a blank form I am able to search for an entry in the AutoCompleteTextField, save the data to my database (without clearing the form), search for a new value, and the data is correctly placed into the form data each time. This suggests that the initialization of the field when the form is opened is causing the issue.
Sid
This issue was entirely of my own making, I am using the same code to both create and edit an entry. To differentiate between new and edit I was testing for valid object being passed to the page, my mistake was that when my text search field was updated I was simply checking if there was a valid object had been passed to the page, of course, the new data was in the form data structure and was never being placed into the object being edited.
The solution was to simply first check if there is a valid input object, if there is then a secondary test is made to see if the form data matched the input object, if not the new data is then placed into the input object.
I'm a new one for android developing. I retrieved a string from hosted database. I want to compare that string and set it as a text according to comparison.
if((dataList.get(position).getname()).equals("5b275526bd5600499cce09ae")) {
holder.txtTitle.setText("denim");
}
else {
holder.txtTitle.setText("shirt");
}
}
The retrieved string is "5b275526bd5600499cce09ae". According to this settext should be "denim". But it display as "shirt".
Then I tried the following one
holder.txtTitle.setText(dataList.get(position).getname());
Then it dispayed as 5b275526bd5600499cce09ae". therefore there is no issues to be seen with the retriving value. I can't figure out with what wrong with this.
Please help me to figure out what's wrong with my code as I'm a new one for Android and Java.
I am making an android application on crm module of odoo 10 and I want to create quotation in odoo through my application and I am passing this various arguments to ORecordValues and after that I am calling the createRecord().So when I am clicking on save button I am calling python api and python api is giving me this error.
Database fetch misses ids (u'1') and has extra ids (1), may be caused by a type incoherence in a previous request
This is my code for inserting record in odoo.
ORecordValues values = new ORecordValues();
values.put("partner_id",resPartnerArrayList.get(idc).get_id());//parter id
values.put("date_order", binding.qOrderDate.getText().toString());
if(!expDate.isEmpty())
{
values.put("validity_date",
binding.qExpirationDate.getText().toString());
}
if(!paymentTerms.isEmpty())
{
values.put("payment_term_id",paymentTermArrayList.get(idP).get_id());//payment term id
}
if(!binding.qUntaxedAmount.getText().toString().isEmpty())
{
values.put("amount_untaxed",binding.qUntaxedAmount.getText().toString());
}
if(!binding.qTotal.getText().toString().isEmpty())
{
values.put("amount_total", binding.qTotal.getText().toString());
}
if(!binding.qTaxes.getText().toString().isEmpty())
{
values.put("amount_tax", binding.qTaxes.getText().toString());
}
return odoo.createRecord("sale.order", values);
I think you trying to pass unicode value to Many2one field. Perform a type conversion. I think in your case its payment_term_id.
Hope it will help you.
I found the Solution that work for me. I got error because i was passing the String in partner_id which odoo is taking as unicode so i parse the type of it and changed it like this. it worked for me.
values.put("partner_id",resPartnerArrayList.get(idc).get_id())
to
values.put("partner_id", Integer.parseInt
(resPartnerArrayList.get(idc).get_id()));
I am trying to make a performance testing process by using the Jmeter for the mobile chat application. The scenario i am trying is,need to analyze the output during the N number of new user registration process.I am feeding the N user data through "CSV Data Set Config".In that mentioned the variable names as "phone,ime".
For each new user registration process,the application will generate the one time password when calling the API1.The question is,I need to get that generated one time password from the API1 response message for each phone user and need to assign the value to the variable ${code} when calling the API2.
The below are the API & parameters details:
API1:/api/users/registration-sms.html?
1) Name:phone, Value: ${phone}
2) Name:ime, Value: ${ime}
Example :
Request - POST data: phone=917010370002 & ime=e78b56418b55b32c
Response:{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
API2: /api/users/registration-sms-verfy.html?
1) Name:phone, Value:${phone}
2) Name:code, Value:${code}
Note : For this variable ${code},We need to get the data from the API1("Code":"5858") response message for the respective phone(917010370002).
Please provide me the feasible solution to sort out of my requirement.
Thanks in advance.
You can use Regular extractor post processor like,
Assuming your response is like
{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
your regular expression will be like to extract code value but for specifiic phone no you need to modify it a little bit,
"Code"\:"(\d+)"
for occurance detail you can provide which match no. you want.
Refer Regular Expression Exctrator Post Processor
in my application I'm calling web service for creating lakes.for that user enters the lake name in edit text and i'm sending that entered name to web service.
now when I'm entering string with space the web service could not call successfully.it shows an exception that illegal char at (the space which I've give in edit text).
i"m not able to find solution for this since i want to send name with space in it.
any help is appreciated.
Thanks
before adding lakeName to the webservice url, do this
final String encodedLakeName = URLEncoder.encode(lakeName, "UTF-8");
Now use this encodedLakeName.