Passing parameters via applet buttons to other JSP ...

User e25fe1ac40

04-01-2005 16:11:38

I have had some difficulty with the following constructs, which alter the example set provided by ChemAxon to do new things. I want a button I've created in my applet genereated hit display table (from "searchresults.jsp") to do an additional search/retrieval. So I pass a parameter to a modified "searching.jsp" as follows





from the "action" portion of the applet parameters





"| <%= obj[0][4] %> |%|searching.jsp?Name=<%= obj[0][4] %>"+ [where obj[0][4] is the field data that represents a compound id]





to capture the "Name" I have in the searching.jsp the following





String Compound = (String)request.getParameter("Name");





followed by





session.removeAttribute("Cmpd");


session.setAttribute("Cmpd", Compound);





The I add to my own sql search filter ("SearchString") as follows





String CompoundIDent = new String((String)session.getAttribute("Cmpd"));


SearchString.append(CompoundIDent);





This does not retrieve the new "Compound" (I get the last succesfully retrieved compund) even though I can use the following manual construct to successfully retrieve a new "Compound"





String Compound = new String("Name");








entering the "Name" parameter manually and everything else being the same.








However, as evidence the dynamic passing seems to be working, I can also output into a HTML text (generated from within "searchresults.jsp") the new "Name" variable using the first, dynamically altered string construct in "searching.jsp" (and the manually altered string construct) as follows (again, from within "searchresults.jsp")





Here is the compound ID <%= (String)session.getAttribute("Cmpd") %>








but the molecule displayed is only from the last successful search ....








Perhaps this is more complex than it has to be, but I admit to being a beginner at Java, JSP and JavaScripting... Thanks, Manton

ChemAxon 9c0afc9aaf

05-01-2005 18:04:08

Hi Manton,





I don't really understand the problem.





1. What is the expected behavior ? (from the user's point of view)





2. What do you do with "SearchString" ?





Best regards,





Szilard

User e25fe1ac40

06-01-2005 07:33:41

Hi Szilard ..





Actually, I have found a solution I have found the problem to be related to "refreshing" the various parameters at the appropriate time and place .. therefore I now place the parameters into the search initiation page "initsearch.jsp" and refresh with "session.removeAttribute()" and reassign with "session.setAttribute()" ... putting these parameters there though has rasied other issues for me, but I think I can solve these shortly ... I will still answer your questions (in case there is perhaps a better way to approach the problem overall) ..... Thanks





Hi Manton,





I don't really understand the problem.





1. What is the expected behavior ? (from the user's point of view)





[my reply]


A hitlist table is obtained, there are buttons which allow the user to retrieve related compounds (based on CompoundID) .....








2. What do you do with "SearchString" ?





[my reply]


It is appended to an SQL query to retrieve the compounds to which the buttons are attached ....





Best regards,





Szilard

ChemAxon 9c0afc9aaf

06-01-2005 08:55:03

Hi Manton,





I'm glad your problem has been solved.





Szilard