Note that there are some explanatory texts on larger screens.

plurals
  1. PODifficulty in passing text as parameter from android to jsp page
    primarykey
    data
    text
    <p>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.</p> <p>Main part of the code(android)</p> <pre><code> 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"); } </code></pre> <p>(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) </p> <p>Now it will move to the JSP. </p> <pre><code>String hk=request.getParameter("rom"); </code></pre> <p>Now i am running a query like this:</p> <pre><code>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+"'))"; </code></pre> <p>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:</p> <pre><code>String page="processing_pages/individual_phone_communicator.jsp?rom=2" </code></pre> <p>and modified the query by trying the exact word instead of 'hk' like this</p> <pre><code>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'))"; } </code></pre> <p>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.</p> <p>But when I try, like this:</p> <p>String page="processing_pages/individual_phone_communicator.jsp?rom=Blood donor"</p> <p>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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload