You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Maruthi Ravuri <ma...@hotmail.com> on 2004/07/05 16:50:32 UTC

problem with passing link from one JSP Portlet to another JSP Portlet (InterJSP

Hello Everybody,

I am still facing the problem with Inter JSP Portlet Communication.I have a 
JSP which
is displaying the News Titles from mysql database.

When i click(titles are having a link) on a particular title the 
corresponding
description of news should be displayed(from datbase) in a separete(another) 
JSP
portlet.

I am not able to get the link from first jsp to second jsp.I am getting 
'null' for
the first time and nothing afterwards.Should i define two jsp's as templates 
in one
portlet-entry in .xreg?.I defined both JSP's differently in .xreg file.Below 
is my
coding for both jsp's ..please tell me where i am doing mistake?.

Thank you very much for your time and patience,
Maruthi.

===================
NewsHead1.jsp
===================
<%@ page    language="java" contentType="text/html" %>
<%@ page    import = "java.io.*" %>
<%@ page    import = "java.lang.*" %>
<%@ page    import = "java.sql.*" %>
<%@ page    import = "javax.servlet.http.*" %>
<%@ page  import = "org.apache.turbine.util.RunData" %>
<%@ page  import = "org.apache.turbine.util.Log" %>
<!-- <%@ taglib  uri='/WEB-INF/templates/jsp/tld/template.tld' 
prefix='jetspeed' %> -->

  <%
  try
  {

  %>
   <body bgcolor="red">
   <FONT face=Verdana,Geneva,Arial color=#FFFAFA size=1>
   <br>

   <h2 align="center"><font color="blue"><b>NEWS HEADLINES</b></font></h2>
   <br>
   <center>
  <%
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection
con=DriverManager.getConnection("Jdbc:mysql://localhost:3306/Thesiswork","root","");
    Statement st=con.createStatement();
    String str="select title from news order by date desc limit 0,5";
    ResultSet rs=st.executeQuery(str);
    StringBuffer requestURL1 = (StringBuffer) request.getRequestURL();
  %>
  <center>
  <table border ="1" bgcolor=#CDC673 align="center" >
        <%
    while(rs.next())
   {
  %>

    <tr>
    <td ><font color="green">
    <center><b>
        <a
href="<%=requestURL1%>?dynamicLink="<%=rs.getString("title")%>""><%=rs.getString("title")%></a>
    <br>
    </font>
    </td>
    </tr>
  <%
  }
  %>
      </table>
   </center>
   <br><br>
      </font>
        </FORM>
  </center>

        </body>

    <%

   }
   catch (Exception e)
  {
      Log.error(e);
     return;
}%>





===================
NewsDetailsJsp.jsp
===================

<%@ page    language="java" contentType="text/html" %>
<%@ page    import = "java.io.*" %>
<%@ page    import = "java.lang.*" %>
<%@ page    import = "java.sql.*" %>
<%@ page  import = "org.apache.turbine.util.RunData" %>
<%@ page  import = "org.apache.turbine.util.Log" %>
<%@ page    import = "javax.servlet.http.*" %>
<!--
<%@ taglib  uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' 
%>
-->

  <%
  try
  {

  %>
   <body bgcolor="red">
   <FONT face=Verdana,Geneva,Arial color=#FFFAFA size=1>
   <br>
   <h2 align="center"><font color="blue"><b>NEWS DETAILS</b></font></h2>
   <br>
   <center>
  <%

     String dynamicLink=(String) request.getParameter("dynamicLink");
     System.out.println("Dynamic Link is :" +dynamicLink);
          Class.forName("org.gjt.mm.mysql.Driver");
     Connection
con=DriverManager.getConnection("Jdbc:mysql://localhost:3306/Thesiswork","root","");
     Statement st=con.createStatement();


    %>
   <center>
   <table border ="1" bgcolor=#CDC673 align="center" >
   <tr><td>Title is :</td><td>News Description will come Here!.</td></tr>

   <%

       String str="select description from news where title="dynamicLink";
               ResultSet rs=st.executeQuery(str);
            while(rs.next())
         {

   %>
        <tr>
           <td width="67%"><font color="green">
            <center><b>Description is 
:<%=rs.getString("description")%></b></center>
           </td>
              </tr>
    <%
         }
       %>
   </table>
   </center>
   <br><br>

   </font>

        </FORM>
  </center>

        </body>

    <%

   }
   catch (Exception e)
  {
      Log.error(e);
     return;
}%>

_________________________________________________________________
Reach out to millions of buyers. http://go.msnserver.com/IN/52047.asp With 
zero investment.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org