• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to pass input text to other jsp thro servlet

 
mohan gavande
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to pass the value to other jsp thro servlet like as

<td><input name="assetsName" type="text" id="assetsname"></td>

I want to pass assetName text field to other Jsp thro' servlet without using form & submit how should i pass it?


If it requres the JAVA Script then please give details of that
Thanking in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64204
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you expect the value to get sent to the server without a submit?

Perhaps you should back up and describe what you are really trying to accomplish.
[ August 17, 2005: Message edited by: Bear Bibeault ]
 
mohan gavande
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually,
I have one JSP page which links to other Jsp page. but senario is while passing to other jsp it should carry the text value from current jsp to other jsp
like example,

<input name="assetName" type="text" id="assetname">

& i want to pass assetName's value to other jsp by using <a href. >
without submit
So how should i pass that?

I cannt use submit for that because i will use that for final submition
if you still doesn,t understand the scenario, then feel free for details explanation.
waiting for replay...
& Thanking in advance.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannt use submit


I doubt that that is really true, if you adapted your server-side accordingly.

You can load a different JSP page through JavaScript by assigning a value to window.location.href. The value you assign can contain paramters like so:
window.location.href = "second.jsp?parameter=value"
where you get the value from the contents of your form.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mohan gavande:

& i want to pass assetName's value to other jsp by using <a href. >
without submit
So how should i pass that?

You could use a query string variable:

These can be retrieved with request.getProperty just like form variables.


I cannt use submit for that because i will use that for final submition
if you still doesn,t understand the scenario, then feel free for details explanation.
waiting for replay...
& Thanking in advance.

I don't understand what you mean by "Final Submit".
If you're moving from page to page, you're going to lose the field values unless you are sending them up to the server and storing them there.
 
Ola Daniel
Ranch Hand
Posts: 105
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben is right... if you are moving from page to page. Before you get to a final
submit page where you commit your data. You might want to store your data in a temporary DB table or somewhere on your server and save your self the truoble of passing parameters from page to page.
 
mohan gavande
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,
Actually in my project there is one main page which takes some input text.
from
in that i have
<input name="assetName" type="text" id="assetname">
like these inputs then i want to pass one parameter which is comming from asstName & i want to pass that value using <a href > to other jsp. after going to other jsp, it uses to that jsp & after submitting, other jsp, the flowes again comes to privious jsp page. & in that when i press submit buttn, all values goes to database.
So how should i make code for that???
the main thing is how should i pass that value to other jsp &
other thing if i come to main jsp, is there text values which i enters before are present or not
 
pippiri venu
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for these you can pass the variable through this
i.e href="nextPage.jsp?Name=<%=Value%>"

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do realize that HTTP is a stateless protocol, right?
Each time you make a request to the server (either via hyperlinks or HTTP Form submission) you are loosing everything from the previous request unless you take specific steps on the server side to maintain it.

One such step would be to store the data in session.
Another would be to write it to a scratch table or record in your database.
 
Rajesh Agarwal
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyways I think the first form in the first JSP needs to be submitted. The in the second form in the second JSP. we can retrieve the values of the submit.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic