Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query String or any other solution please

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • 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
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the above is code of a servlet. and the jsp i used is as follows.

 
Howard Watson
Ranch Hand
Posts: 63
1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic