Hi,
--- Aaron Andersen <[EMAIL PROTECTED]> wrote:
> I've been digging through this list, the jakarta portlet catalog
> and several other places but haven't been able to find an example
> doing something similar to what I would like.
>
> What I want to do is write a Java class that extends
> AbstractPortlet
> or ApplicationPortlet. However, this class will call itself within
> a
> form element. A simple pared down code without all the method calls
>
> and imports follows. Is this possible or am I way off?
> I've done similar things will servlets but can't seem to make it
> work with portlets.
>
This should be fine - we've done it with portlets.
> Thanks in advance for any help.
>
> public class JobSubmit extends AbstractPortlet
> {
>
> public ConcreteElement getContent(RunData data)
> {
> String text = null;
> String action = null;
> Boolean success;
>
> ParameterParser params = data.getParameters();
> action = params.getString("action");
> if (action == null)
> {
> text = "<form
> method=\"POST\"action=\"/jetspeed/servlet/JobSubmit\">\n" +
> "<input type=\"hidden\" name=\"action\"
> value=\"submitjob\">\n" +
> ..... //additional form elements here
> "</form>
Your action should just be /jetspeed - as that is the servlet. The
action will then passed to all portlets - so using a good unique name
might avoid clashes.
> }
> else if(action.equals("submitjob"))
> {
> //get job parameters here
> //submit job based on parameters
> success = jobsubmit( ... );
> if(success)
> {
> text = "Job submitted succesfully!";
> } else {
> text = "Job failed!";
> }
> }
>
> return (new StringElement(text));
>
> }
>
HTH,
Chris
=====
Need somewhere to Live in London - http://freeflats.com
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]