On Tue, Mar 6, 2012 at 8:07 AM, Ruchira Wageesha <ruch...@wso2.com> wrote:
> I don't think it is possible to differentiate request parameters as > strings, integers, floats etc. i.e. when we pass something as a request > param from the client side, we don't consider their types. > > If I have understand your question properly, what is would be > the rationale behind identifying params in [1] as numbers and [2] as > strings? > Did you note the cast in the code? Try without cast and see... > > Thanks & Regards, > Ruchira > > [1] http://foo.com/calc?param1=1¶m2=2 > [2] http://foo.com/search?param1=hello¶m2=world > > On Mon, Mar 5, 2012 at 8:29 PM, Samisa Abeysinghe <sam...@wso2.com> wrote: > >> Reason I am saying is that I wrote a cal to demo session and >> the param could not be added out of the box. I have to make use of ' * >> parseFloat'* >> >> See code below. >> >> <% >> var operation = request.getParameter("operation"); >> var value1 = parseFloat( request.getParameter("value1") ); >> var value2 = parseFloat( request.getParameter("value2") ); >> >> var result = 0; >> var memory = 0; >> >> if (operation == "add" ) { >> result = value1 + value2; >> } else if (operation == "sub" ) { >> result = value1 - value2; >> } else if (operation == "mul" ) { >> result = value1 * value2; >> } else if (operation == "div" ) { >> result = value1 / value2; >> } else if (operation == "mem" ) { >> memory = session.get("result"); >> result = memory + value1; >> } >> >> session.put("result", result); >> >> if (operation == "mem" ) { >> print( memory + " + " + value1 + " = " + result ); >> } else { >> print( value1 + " " + operation + " " + value2 + " = " + result ); >> } >> %> >> >> >> >> >> On Mon, Mar 5, 2012 at 8:27 PM, Samisa Abeysinghe <sam...@wso2.com>wrote: >> >>> Cannot treat a number param as a number. >>> >>> Thanks, >>> Samisa... >>> >>> Samisa Abeysinghe >>> VP Engineering >>> WSO2 Inc. >>> http://wso2.com >>> http://wso2.org >>> >>> Thanks, >> Samisa... >> >> Samisa Abeysinghe >> VP Engineering >> WSO2 Inc. >> http://wso2.com >> http://wso2.org >> >> >> >> _______________________________________________ >> Carbon-dev mailing list >> Carbon-dev@wso2.org >> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >> >> > > > -- > Ruchira Wageesha > Software Engineer - WSO2 Inc. www.wso2.com > > Email: ruch...@wso2.com Blog: ruchirawagee...@blogspot.com > Mobile: +94775493444 > > Lean . Enterprise . Middleware > > _______________________________________________ > Carbon-dev mailing list > Carbon-dev@wso2.org > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev > > Thanks, Samisa... Samisa Abeysinghe VP Engineering WSO2 Inc. http://wso2.com http://wso2.org
_______________________________________________ Carbon-dev mailing list Carbon-dev@wso2.org http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev