• 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

Query String or any other solution please

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have a jsp in which there is a textbox, what i wanted to do is after posting the data i want a redirection happening in and string in ADD(please refer the below code) to be in the empty text box in page 1, the problem i'm facing is there is a query in first page which is making this textbox empty. i heard that i can take use of QueryString() or please suggest me any other process if available, but i'm not sure of how to use it. the redirection code is as below.




and the name of my text box is tgt1 in page 1.

Thanks
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your first page look like?? Can you post the code of your JSP page containing the textbox you are displaying value in?

*PS: - Ideally, it is a very bad practice to code so much of Business logic (That too containing database talk) in your JSP..
Your JSP should just do the task of displaying the data, rest of the business logic should go into a controller (A Servlet)
 
Rakesh Keerthi
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the above is code of a servlet. and the jsp i used is as follows.

 
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

String s="Users.jsp?tgt1="+Add+"";(i wanted to know what should go here)


I'm not sure what you are looking for here, but would create a URN with a query string parameter named tgt1 with the value of Add appended.
In the context of your coding style your JSP would have and your input would be
Comments: You have two inputs outside your form in your JSP. One has

value="<%=rs.getString("DBID")%>".

indicating you do have your database code in your JSP. And based on this

<input type="Submit" style="display: none" value="Add Query"id="Query_but" onclick="invoke(2);">

you probably have your javascript code in it as well. When you get this working it would be a good idea to follow R. Jain's PS and practice some separation of concerns (SoC). You're knee deep in bear scat here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic