portals-jetspeed-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tiwari, Sunil Kumar" <c_sti...@qualcomm.com>
Subject RE: Re: How to create a new skin and add custom mode to it injetspeed2?
Date Sat, 07 Jan 2006 05:35:08 GMT



-----Original Message-----
From: news on behalf of Aaron Evans
Sent: Fri 1/6/2006 11:41 AM
To: jetspeed-user@jakarta.apache.org
Subject:  Re: How to create a new skin and add custom mode to it injetspeed2?
 
Tiwari, Sunil  Kumar <c_stiwar <at> qualcomm.com> writes:

> The search box request must be passed to a servlet.
> I have created a .vm file for this where I have a html form tag and I
> try to call an action on it but somehow it doesn't work.
> 
> Any ideas?

Sunil,
If you are simply trying to post to a servlet outside of jetspeed (but on the 
same server), just make the URL of the action the URI of the servlet.  That is, 
something like:

/<servlet_application_context>/<URI_that_maps_to_your_servlet>

Just remember that the user will then leave the portal and be brought to the
response of your servlet.  Further, unless you have tomcat SSO turned on, you 
will lose the identity of the user that has invoked the servlet.

What would probably be better is to turn your search servlet into a portlet and
then figure out how to have the search form (in the header) trigger your 
portlet. Let me know when you figure that out! :)

Aaron,

Thanks for your advise and I tried out your suggestion and it worked perfectly!
I am simply trying to post to a servlet outside of jetspeed.

But I have a query here which doesnt concern with servlet but to velocity template and java
script.

Suppose the request url is generated dynamically i.e the action can be triggered to different
servlets depending on some parameter.

Now I have a search box and the search string can be posted to google, yahoo or some custom
servlet(provided as radio buttons).

I have a form element in my jsp.

<form name="form1" action="javascript:null" onSubmit="javascriptFunction(this.form);">

In the javascript function, I find out which radio button was selected and accordingly specify
the form.action="some url". The url is a complete one like http://google.com

If the user selects the custom servlet radio button then I assign the form.action= <%=servletURl%>
(servletUrl is computed in a jsp scriplet)

This code works fine for a websphere theme.

I moved it to Jetspeed by making it a .vm file and it works fine except for the servlet case.
The problem is that it doesnt recognise <%=servletURl%> within the javascript. Its obvious
so I changed it accordingly using VTL variable.

I store the servletUrl in $url and then form.action=$url in javascript. It didnt work. I tried
form.action=#url and #$url but I knew it wldnt work.

The question is how to use VTL variable within javascript??

You must be wondering why I have explained all this instead of asking directly, but I guess
it makes the picture clear.

I think there must be some way to do it and if there is no way then how to get a work around
for it.

Thanks!
-Sunil


Mime
View raw message