[opencms-dev] Re: forward command

Alexander Kandzior alex at opencms.org
Thu Jun 30 11:34:13 CEST 2005


You may try the 6.0.0 version since we made some improvements in the
"forward" support.

To use "forward", you need to apply the cache property "bypass" to the JSP
in that uses the forward. Then everything should work as expected, including
access to the parameters of the request.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of bub habub
> Sent: Thursday, June 30, 2005 11:11 AM
> To: open cms
> Subject: [opencms-dev] Re: forward command
> 
> hi,
> 
> so i tried now so many things. and came to the conclusion 
> that i somehow don't get the parameters that i try to get 
> from the first page. 
> 
> i think the response.sendRedirect("mail.jsp"); 
> 
> works but then the next page cannot get the parameters from 
> this former page and therefore throws a java.lang.NullPointerException
> 
> 
> why can't i get the variabls values that i have declared in 
> in the former page?
> 
> here my code, maybe someone finds any mistakes:
> 
> first page that should check on the files
> 
> <%@page import="org.opencms.file.*,
> org.opencms.file.collectors.*, java.util.*, 
> org.opencms.jsp.*, org.opencms.flex.*, 
> org.opencms.util.CmsUUID" %> <%@ taglib prefix="cms"
> uri="http://www.opencms.org/taglib/cms" %> <% 
> CmsJspActionElement cms = new 
> CmsJspActionElement(pageContext, request, response); 
> //CmsDefaultResourceCollector collector = new 
> CmsDefaultResourceCollector(); String folder = "www/"; 
> out.println("Current folder=" + folder);
> 
> CmsObject cmsobject =
> CmsFlexController.getCmsObject(request);
> List listfiles =
> cmsobject.getResourcesInFolder(folder,
> CmsResourceFilter.DEFAULT_FILES);
> 
> Iterator iterator = listfiles.iterator(); out.println("Items 
> in this folder: list:"); long lastdate, time; Date today = new Date();
> 
> 
> while (iterator.hasNext())
> {
>     	CmsFile temp = (CmsFile)iterator.next();
> 	//out.println(temp);
> 	lastdate = temp.getDateLastModified();
> 	//out.println(date);
> 	
> 	time = today.getTime();
> 	//out.println(time);
> 	if(time-lastdate > 111840950)
> 	{
> 		
> 		CmsUUID userid = temp.getUserLastModified();
> 		CmsUser projectleader = cmsobject.readUser(userid);
> 		
> 		//out.println(userid);
> 		String emailofuser = projectleader.getEmail();
> 		String lastname = projectleader.getLastname();
> 		out.println(emailofuser);
> 		
> 		String url = temp.getRootPath();
> 		String filename = temp.getName();
> 		//out.println(url);
> 		out.println(filename);				
> //muss noch genauer
> aufgebaut werden
> 		String forwardUri = "send_update_note.jsp";
>  
> 		//response.sendRedirect(cms.link(forwardUri));
> 		response.sendRedirect("send_update_note.jsp");
> 		}
> }
> 
> %>
> 
> 
> second page that is supposed to send an email when a certain 
> time period has run down.
> 
> <%@ page import="org.opencms.mail.*, java.io.*, java.util.*, 
> org.opencms.jsp.*" %> <%@ taglib prefix="cms"
> uri="http://www.opencms.org/taglib/cms" %> <% 
> CmsJspActionElement cms = new 
> CmsJspActionElement(pageContext, request, response);
> 
> String email = request.getParameter("emailofuser");
> String lname = request.getParameter("lastname");
> 
> CmsHtmlMail amail = new CmsHtmlMail();
> 
> // Set To
> out.println(email);
> out.println(lname);
> amail.addTo(email);
> 
> 
> //Set From
> 
> String from = new String("onkel puenktlich" );
> 
> amail.setFrom("japorami at yahoo.com", lname);
> 
> // Set Subject
> 
> amail.setSubject("Please update project"); // better with a 
> variable for multiple use
> 
> // Set Headers
> 
> //amail.setHeaders(ht);
> 
> 
> // Set Host
> amail.setHostName("ipaddress");
> 
> 
> // Details for Authentication
> 
> amail.setAuthentication("something");
> 
> String htmlcontent = cms.getContent("test2.html"); 
> out.println(htmlcontent);
> 
> amail.setHtmlMsg(htmlcontent);
> 
> // Sending the Email
> amail.send();
> 
> %> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list