File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Query String or any other solution please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Query String or any other solution please" Watch "Query String or any other solution please" New topic
Author

Query String or any other solution please

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
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

Joined: Aug 11, 2012
Posts: 367
    
    1

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

Joined: Jul 16, 2012
Posts: 136
the above is code of a servlet. and the jsp i used is as follows.

Howard Watson
Ranch Hand

Joined: Jan 07, 2004
Posts: 51
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query String or any other solution please
 
Similar Threads
How to set date in mysql using prepared statement?
Remain in same page even after submitting the form
Oracle table takes Null
Compare textbox data with sql table data
Remain in same page even after submitting the form