How to get request params easily?

View: New views
6 Messages — Rating Filter:   Alert me  

Parent Message unknown How to get request params easily?

by Andrey1981 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Dear list members,

I'm newby in Woodstock framework...

Is there any simple way how to set the request params of RequestBean1 object from the request?

This way is too long and awful:

        Map params = getExternalContext().getRequestParameterMap();

        if (params.get("param1") != null)
        getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toString()));


Thanks in advance,
Regards,

 -Andrey


Re: How to get request params easily?

by Ryan Lubke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrey Siver wrote:

>
>
> Dear list members,
>
> I'm newby in Woodstock framework...
>
> Is there any simple way how to set the request params of RequestBean1
> object from the request?
>
> This way is too long and awful:
>
>         Map params = getExternalContext().getRequestParameterMap();
>
>         if (params.get("param1") != null)
>        
> getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toString()));
>
>
> Thanks in advance,
> Regards,
>
>  -Andrey
>
I'm guessing RequestBean1 is a JSF managed bean?
If so, you can leverage managed properties to set the value like so:

(this is a child element of managed-bean)

<managed-property>
    <property-name>param1</property-name>
    <value>#{param.param1}</value>
</managed-property>

When RequestBean1 is instantiated, it will pass the value of the request
parameter
'param1' to your setter, setParam1() for you.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Re: How to get request params easily?

by RobBass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Netbeans had some tutorials on this and it makes development almost
trivial.  I am still new at all of this yet I built an entire web
application just using Netbeans, now if I can only figure out why
listbox render with different widths in IE vs. Firefox....

Check out:

http://www.netbeans.org/kb/trails/web.html

Or specifically:

http://www.netbeans.org/kb/60/web/scopes.html


Thanks,

Rob
 
-----Original Message-----
From: Ryan.Lubke@... [mailto:Ryan.Lubke@...]
Sent: Wednesday, June 18, 2008 9:44 AM
To: users@...
Subject: Re: How to get request params easily?

Andrey Siver wrote:

>
>
> Dear list members,
>
> I'm newby in Woodstock framework...
>
> Is there any simple way how to set the request params of RequestBean1
> object from the request?
>
> This way is too long and awful:
>
>         Map params = getExternalContext().getRequestParameterMap();
>
>         if (params.get("param1") != null)
>        
>
getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toSt
ring()));
>
>
> Thanks in advance,
> Regards,
>
>  -Andrey
>
I'm guessing RequestBean1 is a JSF managed bean?
If so, you can leverage managed properties to set the value like so:

(this is a child element of managed-bean)

<managed-property>
    <property-name>param1</property-name>
    <value>#{param.param1}</value>
</managed-property>

When RequestBean1 is instantiated, it will pass the value of the request

parameter
'param1' to your setter, setParam1() for you.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: How to get request params easily?

by Andrey1981 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Ryan,

Possibly I formulated the question not very good :).
So: is it possible to get request param (sending to JSP page) easily then:
>>>
Map params = getExternalContext().getRequest
ParameterMap();

Double param1;
if (params.get("param1") != null)
        param1 =
(Double.parseDouble(params.get("param1").toString()));
<<<

It would be great if every bean field in RequestBean1 set up automatically from the request.
So it would be enough just right >>>Double param1 = RequestBean1.getParam1(); <<< (and requestBean1.param1 should be set somewhere during initialization).

Thanks,

-Andrey

2008/6/18 Ryan Lubke <Ryan.Lubke@...>:
I'm guessing RequestBean1 is a JSF managed bean?
If so, you can leverage managed properties to set the value like so:

(this is a child element of managed-bean)

<managed-property>
  <property-name>param1</property-name>
  <value>#{param.param1}</value>
</managed-property>

When RequestBean1 is instantiated, it will pass the value of the request parameter
'param1' to your setter, setParam1() for you.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



RE: How to get request params easily?

by Oddvard M :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrey,
 
I hope this prerender method from a JSF page containing a Woodstock TextArea component will help:
 
public void prerender() {
        HttpServletRequest request = (HttpServletRequest) this.getExternalContext().getRequest();
        Enumeration headerIter = request.getHeaderNames();
        while(headerIter.hasMoreElements())
        {
            String headername = (String) headerIter.nextElement();
            String areaText = null;
            if(this.textArea1.getText() != null)
            {
                areaText = this.textArea1.getText().toString();
            }
            areaText += headername + ": " + request.getHeader(headername) + '\n';
            this.textArea1.setText(areaText);
        }
 
        String areaText = this.textArea1.getText().toString();
        areaText += request.getLocalName() + '\n' + request.getLocalAddr() + '\n';
        this.textArea1.setText(areaText);
        String clientAddr= "Client IP: " + request.getRemoteAddr();
        String clientPc = "Client host: " + request.getRemoteHost();
        areaText += clientAddr + '\n' + clientPc;
        this.textArea1.setText(areaText);
    }
 
Oddvard
-----Original Message-----
From: Andrey Siver [mailto:andrey.siver@...]
Sent: Wednesday, June 18, 2008 3:38 PM
To: users@...
Subject: How to get request params easily?



Dear list members,

I'm newby in Woodstock framework...

Is there any simple way how to set the request params of RequestBean1 object from the request?

This way is too long and awful:

        Map params = getExternalContext().getRequestParameterMap();

        if (params.get("param1") != null)
        getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toString()));


Thanks in advance,
Regards,

 -Andrey


Get data form scheduler component

by atark :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear list members, im newby in WoodsTock framework...
I need use the new scheduler componet..  i saw the examle on the web and the tags document but i dont know how use schedulerBean class for extract data of this component.
For example (see the attachment) I put  a button and a statictext in the window with the scheduler component and In the button action I write  staticText1.setText(scheduler1.getvalue().toString());
 
So when I click the button I can see an entire text with the data but not separate.
 
Please somebody tell me how can I use schedulerBean, do I call from applicationBean? With getters and setters?
 
If anybody have an example please send me it.
 
Regards
Roberto

Andrey Siver <andrey.siver@...> wrote:


Dear list members,

I'm newby in Woodstock framework...

Is there any simple way how to set the request params of RequestBean1 object from the request?

This way is too long and awful:

        Map params = getExternalContext().getRequestParameterMap();

        if (params.get("param1") != null)
        getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toString()));


Thanks in advance,
Regards,

 -Andrey




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Pantallazosche.jpg (121K) Download Attachment
LightInTheBox - Buy quality products at wholesale price