You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Tommaso Nuccio <to...@fwctc.com> on 2005/12/02 14:00:27 UTC

Problems with Parameters and Forms

Hi all,

after successfully working with jetspeed 1.5 and implementing some static 
portlets, I want to go a step further and create dynamic portlets with forms.
Unfortunately I have a problem, I cannot understand and solve, because I think 
I already elimitated the mistakes. Still it does not work.

My understanding regarding parameters/forms is:
- they are primarily used to pass data/information from a portlet to another 
portlet or to the portlet itself. I can achieve this by registering parameters 
in the portlet registry entry or do it dynamically in the code(? I am not sure 
on this one). I get and set parameters using the "rundata".
- Processing forms' data/information is done with the action.class for the 
specific portlet, which is declared under the portlet registry 
entry "<parameter action="XYZaction.class"/>". The action specific method in 
this class is invoked by declaring it in the form's INPUT(submit-button), e.g. 
<FORM>
  <INPUT TYPE="SUBMIT" NAME="eventSubmit_dorefresh" VALUE="Refresh" >
</FORM>

The problem is:
I cannot get
a) the parameter value of the portlet
b) the submitted form values of the portlet.

Why am I wrong? I mean, which important point am I missing?
I can get to see all attributes of the portlet, like JSPID, SSL Session, and 
so on, but not the one I defined!!

The do refresh code looks like this:
public void doRefresh(RunData rundata, Portlet portlet)
{
  String temp = "";
  temp = rundata.getParameters().getString("sql");
  PortletSessionState.setAttribute(portlet, rundata, "sql", temp);
}
"sql" is a parameter I defined in the portlet:
<parameter name="sql" value="select * from test" hidden="false" 
cachedOnName="true" cachedOnValue="true">
  <security-ref parent="admin-only"/>
  <meta-info>
    <title>SQL Query</title>
    <description>A descr.</description>
  </meta-info>
</parameter>

I want to access it in the template.jsp:
if(rundata == null)
  out.write("No Data to run!");
else
{
  for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();)
  {
    out.write(e.nextElement().toString() + " <br>");
  }
  out.write("---------------- <br>");
  out.write("SSL Session: " + (String) 
request.getAttribute "javax.servlet.request.ssl_session") + "<br>");
  out.write("PEID: " + (String) request.getAttribute("js_peid") + "<br>");
  out.write("TEMPLATE: " + (String) request.getAttribute("template") + "<br>");
  out.write("SQL: " + (String) request.getAttribute("sql") + "<br>");
}

The last out.write results in "Null" and I don't have any idea.

Any help appreciated and more than welcome :o)

Ciao,
  Tommaso


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


Re: Problems with Parameters and Forms

Posted by Tommaso Nuccio <to...@fwctc.com>.
Raphaël Luta <raphael <at> apache.org> writes:

> 
> In Jetspeed 1, you'll get the parameters in PSML using
> rundata.getInitParameter(<myparamName>).
> 

Hi Raph,

thank you for your help.
This answers alot of questions. Indeed, I already got the rest working, forms 
and parameters.
Do you have any good resource for jetspeed documentation?

Ciao,
  Tommaso



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


Re: Problems with Parameters and Forms

Posted by Raphaël Luta <ra...@apache.org>.
Tommaso Nuccio wrote:
> Hi all,
> 
> <snip> 
> The do refresh code looks like this:
> public void doRefresh(RunData rundata, Portlet portlet)
> {
>   String temp = "";
>   temp = rundata.getParameters().getString("sql");
>   PortletSessionState.setAttribute(portlet, rundata, "sql", temp);
> }
> "sql" is a parameter I defined in the portlet:
> <parameter name="sql" value="select * from test" hidden="false" 
> cachedOnName="true" cachedOnValue="true">
>   <security-ref parent="admin-only"/>
>   <meta-info>
>     <title>SQL Query</title>
>     <description>A descr.</description>
>   </meta-info>
> </parameter>
> 
> I want to access it in the template.jsp:
> if(rundata == null)
>   out.write("No Data to run!");
> else
> {
>   for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();)
>   {
>     out.write(e.nextElement().toString() + " <br>");
>   }
>   out.write("---------------- <br>");
>   out.write("SSL Session: " + (String) 
> request.getAttribute "javax.servlet.request.ssl_session") + "<br>");
>   out.write("PEID: " + (String) request.getAttribute("js_peid") + "<br>");
>   out.write("TEMPLATE: " + (String) request.getAttribute("template") + "<br>");
>   out.write("SQL: " + (String) request.getAttribute("sql") + "<br>");
> }
> 
> The last out.write results in "Null" and I don't have any idea.
> 
> Any help appreciated and more than welcome :o)
> 

In Jetspeed 1, you'll get the parameters in PSML using
rundata.getInitParameter(<myparamName>).

-- 
Raphaël Luta - raphael@apache.org
Apache Portals - Enterprise Portal in Java
http://portals.apache.org/

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