Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assign string to an extern page !!!!!!

 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
is it possible to assign a string in a textfield of an extern page that I forward...if yes...how....
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid I don't understand what it is you're trying to do. Could you please elaborate?
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
ok, for example you want to reach a extern page from your page (e.g: www.google.com) to retrieve information from this page.
and you want to assign a string to the page www.google.com and to execute the request....


hopefully i expressed it better this time

regards
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can just pass whatever information you want as parameters.

For example:

<a href="http://www.google.com/search?hl=en&q=java">Click here to find google entries for Java</a>

If the page is dynamic, you can make dynamic substitutions for the parameters as in:

<a href="http://www.google.com/search?hl=en&q=<%=search >">Click here to find google entries for <%=search ></a>
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi merril,
i have tried the first link and it works fine, but the second doesn't work...
get the following error message:



but my actual page, that I want to reach is:
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=protein

and there I want my string in the textfield above....

thanks
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and is there a possibility that it could be executed too.....
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was a typo on my part. The line that I gave you should have read:


<a href="http://www.google.com/search?hl=en&q=<%=search %>">Click here to find google entries for <%=search %></a>

Note that in order for this to work, you'd have to establish the variable "search" in your JSP prior to the statement. Something like this:

<% String search = "java"; %>
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi merrill,
I have tried to assign the string (accession_code) in the jsp page to a hyperlink (html:link) and to a button (html:button) but it doesn't work.
but i guess it should work in that way.....

code for html link:


code for html button:
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi merrill,
sorry for this mess, but I tried to paste the entire code, but I couldn't get it to work....

you can see that both html:link and html:button has the property "accession_code" so I just want that if I click on the link or button that it takes the property and forward to the specified page with the string....
I have tried it with onlick and ohter things...... and your code fragment...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The above tags are not well-formed, nor do they conform to the requirements of the TLD, so it's no mystery that they don't work.

Please read This link to understand how to use the <html:link> tag.

You must specify the URL of your destination page using the "href" property. The paramName must refer to a javaBean that has already been created in some scope (request, session, etc.). If the javaBean can be displayed as a String, paramName is all you need. If the bean has a property you want to use, you must specify which property to use with the paramProperty attribute of the tag.

Here's my previous example reworked to use the <html:link> tag

 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
thanks, you code fragment worked fine for the google page, but if i tried it with the page I want to forward it didn't work.



I want to forward to this page http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=protein
and assign the string to the textfield, but I couldn't get it to work, so I tried it the way shown above, but it didn't work either....

thanks...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went to the URL you gave and did a "view source" of the page from my browser. I found that the name of the <input> for the search field is "term". That means the name of the parameter you have to pass to the URL is "term".

Also, if you've already defined a bean named proPep with a property of accession_code, you don't have to re-define it with a bean:define tag. Just use it.

With that said, the following should work.

 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi merrill,
thanks a lot, it works very well...

regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic