• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

getting more dynamic in a result page

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This conversation has drifted to:
https://coderanch.com/t/287152/JSP/java/jsp-thing
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic