[opencms-dev] Passing a value from one jsp to another

maria.freixes_graells at alcatel.es maria.freixes_graells at alcatel.es
Fri Sep 22 14:10:18 CEST 2006


Thanks Jonathan!!

But I was looking something more easy, let me explain a little more.....
I have the form:

<form method="post" action="result55.jsp" >
in a jsp file, and inside this file, I have the carpetalink variable:   
<% String carpetalink = request.getParameter("neulink"); %>

Then, I want to pass the carpetalink variable to the result55.jsp.......

I am thinking something like:  
 
in the first file:
<input type="hidden" name="carpeta" value="<%carpetalink%>">

and in the result55.jsp one:

<%
   String carpeta = request.form();
%>

But It doesn't work, I've the following error:

org.apache.jasper.JasperException: Unable to compile class for JSP An 
error occurred at line: 171 in the jsp file: 
/WEB-INF/jsp/offline/system/workplace/views/explorer/result55.jsp 
Generated servlet error: The method form() is undefined for the type 
HttpServletRequest at 
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) 
at 
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java

Could you help me, please?
Someone have any idea?

Thanks,
Maria



Jonathan Woods escribió:
> Maria -
>
> You can store state in CmsRequestContext using its method
> setAttribute(String key, Object value).  An instance of CmsRequestContext -
> of which there is one per user-initiated request - is available from a
> method on CmsObject.  Warning: as a design pattern, try to avoid storing
> lots of different kinds of objects in the request context, because you run
> into all sorts of problems with hard-coded assumptions about the type of
> each.  I ended up implementing my own single class to store
> application-specific state, and storing only this one in the request
> context, keyed by a single String value:
>
> // In JSP 1:
>
> final CmsJspActionAlement cmsJspActionElement = new CmsJspActionElement();
> cmsJspActionElement.init(pageContext, request, response); // standard JSP
> symbols
> final CmsObject cmsObject = cmsJspActionElement.getCmsObject();
> final CmsRequestContext cmsRequestContext = cmsObject.getRequestContext();
>
> final ApplicationRequestState appState = new ApplicationRequestState(...);
> // do stuff to set up appState here.
> cmsRequestContext.setAttribute(ApplicationConstants.APP_STATE_KEY_WHICH_IS_A
> NYTHING_YOU_LIKE, appState);
>
> ...
>
> // In JSP 2:
>
> final CmsJspActionAlement cmsJspActionElement = new CmsJspActionElement();
> cmsJspActionElement.init(pageContext, request, response);
> final CmsObject cmsObject = cmsJspActionElement.getCmsObject();
> final CmsRequestContext cmsRequestContext = cmsObject.getRequestContext();
> final ApplicationRequestState appState = (ApplicationRequestState)
> cmsRequestContext.get(ApplicationConstants.APP_STATE_KEY_WHICH_IS_ANYTHING_Y
> OU_LIKE);
> 		
> // Now do stuff using the app state you set up in the earlier JSP.
>
> Jon
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of
> maria.freixes_graells at alcatel.es
> Sent: 21 September 2006 12:09
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] Passing a value from one jsp to another
>
> Hello Everybody!!
>
> I've the following form in one of my jsp file, in order to select a folder
> from the OpenCms, but now, I would like to pass the folder selected to
> another file jsp, and I've trying to do it but I don't know the good way to
> do it. Any idea about the code to add to my first jsp where I have the form,
> and evenmore, what I would add to the other jsp in order than could receive
> the folder selected?
>
> Many thanks and best regards,
> Maria
>
>
> <form name="NEU" class="nomargin" onsubmit="pasteLink();">
>
> <table border="0" cellspacing="0" cellpadding="4" width="100%">
>                 <tr>
>                     <td style="white-space: nowrap;"><%=
> wp.key(org.opencms.workplace.editors.Messages.GUI_INPUT_LINKTO_0) %>:</td>
>                     <td class="maxwidth">
>                         <input type="text" name="neulink"  
> class="maxwidth" value="" onchange="checkLinkUrl();" />
>                     </td>        
>                     <th>Select a directory to start searching</th>
>                     <td><a href="javascript:openTreeWin('NEU',
> 'neulink', document);"><img src="<%= CmsWorkplace.getSkinUri()
> %>filetypes/folder.gif" border="0" alt="<%=
> wp.key(org.opencms.workplace.editors.Messages.GUI_LABEL_SELECTFOLDER_0)%>"><
> /a></td>
>
>                 </tr>
>                
>            
>             </table>
>
>
> <%= wp.dialogContentEnd() %>
>
> <%= wp.dialogButtonsOkCancel(null, "onclick=\"window.close();\"") %> </form>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list To change your
> list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>   



More information about the opencms-dev mailing list