This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

getting more dynamic in a result page  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi group,

i have some sort of problem in JSP which sure has an answer..but ,i am not figuring it out.

the problem no. 1
--------------------
i wrote a servlet which dispatches the search results( a pattern-matched set of employees) to my jsp as an advanced search ("/search_advance.do"). this set contains fields like name, age etc. and a primary key "EID".

at the same time i made a search criteria ("/search_basic.do") which only takes the "EID" to give full detail of the employee.

when a user gets result from the advanced search in a table,i want him to just click on the EID field to know full dtail of that employee. In short when he clicks an EID (in advanced result) he must be able to envoke "/search_basic.do?EID=theeid&B1=submit&formOption=basic"....so i wrote something like this

out.print("<td>");
out.print( " <A href=http://localhost:8888/sobis/search_basic.do?EID=" + element1 + "&B1=submit&formOption=basic>");
out.print(element1);
out.print("</A></td>");

formOption is a hidden field to distinguish basic form from advanced form(bcoz both are in the same page.)
It never worked..all i know is the same form("~/search_advanced.do?/search_basic.do?EID=theeid") is envoked again, with parameters shown in url.


// here is the scriptlet

<%
//Collected Lists

List mEID = (List)request.getAttribute("mEID");
List mfirst_name = (List)request.getAttribute("mfirst_name");
List mmiddle_name = (List)request.getAttribute("mmiddle_name");
List mlast_name = (List)request.getAttribute("mlast_name");
List maddress = (List)request.getAttribute("maddress");
List mjoining = (List)request.getAttribute("mjoining");


Iterator it1 = mEID.iterator();
Iterator it2 = mfirst_name.iterator();
Iterator it3 = mmiddle_name.iterator();
Iterator it4 = mlast_name.iterator();
Iterator it5 = maddress.iterator();
Iterator it6 = mjoining.iterator();
out.print(" <tr><th>EID</th><th>Last Name</th><th>First Name</th><th>Middle Name</th><th>Address</th><th>Joining</th></tr>");

// display it

while( it1.hasNext() && it2.hasNext() && it3.hasNext() && it4.hasNext() && it5.hasNext() && it6.hasNext())
{
Object element1 = it1.next();
Object element2 = it2.next();
Object element3 = it3.next();
Object element4 = it4.next();
Object element5 = it5.next();
Object element6 = it6.next();

out.print("<tr>");

out.print("<td>");
//out.print( " <A href=http://localhost:8888/sobis/search_basic.do?EID=" + element1 + "&B1=submit&formOption=basic>");
out.print(element1);
out.print("</A></td>");

out.print("<td>");
out.print(element4);
out.print(",</td>");

out.print("<td>");
out.print(element2);
out.print("</td>");

out.print("<td>");
out.print(element3);
out.print("</td>");

out.print("<td>");
out.print(element5);
out.print("</td>");

out.print("<td>");
out.print(element6);
out.print("</td>");

out.print("</tr>");
}
out.print(" </table>");
%>

/** @@@@@@@@@@@@@@@@@@@@ end @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


problem no. 2
--------------------

how to do every thing which i am doing in JSP (getting result from db and showin') in a flash program.
 
author & internet detective
Sheriff
Posts: 38571
661
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay,
Welcome to JavaRanch!

It's actually better to do this in a servlet and a JSP than just a JSP.

In the servlet, you do the query (as you are doing it now.) You place the results in a request attribute. Then in the JSP, you get the attributes from the result and display them.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!