• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp link inputs  RSS feed

 
J Das
Ranch Hand
Posts: 83
Firefox Browser Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a problem here in my jsp code... this page returns all the available buses ....these information is collected from a servlet which forwards the available buses data to this jsp page... now my question is when this page shows up , there exists hyperlinks to each available buses ... on clicking in any one of the links ( which sigfnify my choice of selecting the bus with which i want to travel) , a form will appear where customer will have to specify his info... okay fine... but how are these hyperlinked choices going as inputs ??? can someone explain me with proper code ??? In short my question is how can i make hyperlinked items as inputs ..??? The following is the jsp code .... ( and i know it's not good to add java code in jsp directly ... So apart from that any suggesstion to fullfill my goal please....)

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36457
460
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a href="form.jsp">
This takes you to another page but doesn't provide a way of knowing which item you care about.

<a href="form.jsp?item={$item}>
This adds it as a parameter.

<a href="/form?item={$item}>
This is even better because it uses MVC and doesn't have you sending directly from one JSP to another. (The logic/flow in the JSP is worse than the Java in the JSP.)

[edited because software bug wiped out my posts]
 
J Das
Ranch Hand
Posts: 83
Firefox Browser Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:<
(The logic/flow in the JSP is worse than the Java in the JSP.)



which flow are you talking about... be specific please.. i need to learn so point out my mistakes..
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36457
460
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having one JSP forward directly to another. This forces all of your logic to be in the JSP. It should be in a servlet instead so the JSP is just handling presentation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!