wood burning stoves 2.0*
The moose likes Struts and the fly likes assign string to an extern page !!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "assign string to an extern page !!!!!!" Watch "assign string to an extern page !!!!!!" New topic
Author

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

Hubert Pernegger
Ranch Hand

Joined: Apr 11, 2006
Posts: 49
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

Joined: Feb 15, 2005
Posts: 4864
I'm afraid I don't understand what it is you're trying to do. Could you please elaborate?


Merrill
Consultant, Sima Solutions
Hubert Pernegger
Ranch Hand

Joined: Apr 11, 2006
Posts: 49
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Apr 11, 2006
Posts: 49
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

Joined: Apr 11, 2006
Posts: 49
and is there a possibility that it could be executed too.....
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Apr 11, 2006
Posts: 49
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

Joined: Apr 11, 2006
Posts: 49
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Apr 11, 2006
Posts: 49
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Apr 11, 2006
Posts: 49
hi merrill,
thanks a lot, it works very well...

regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: assign string to an extern page !!!!!!
 
Similar Threads
assign the two dimension array in struct jsp page
Extern Keyword?
noob needs help with path
doubt regarding Boolean constructor