473,554 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display value of float from servlet to jsp page.

283 Contributor
Hi friends,
The situation is, in my class i have certain float parameters like--->
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2.             float f3 = double1.floatValue();
and s18 is--> s18 = resultset.getSt ring("Budget_Al loted");
and so on...
and in my jsp page i want to display the value of f3
for ex-->[HTML]BUDGET ALLOTED : <b>" + f3 + "</b><br>[/HTML] . How can i do that. Any help will be appreciated.
regards,
ajos
Nov 19 '07 #1
11 7673
r035198x
13,262 MVP
Hi friends,
The situation is, in my class i have certain float parameters like--->
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2.             float f3 = double1.floatValue();
and s18 is--> s18 = resultset.getSt ring("Budget_Al loted");
and so on...
and in my jsp page i want to display the value of f3
for ex-->[HTML]BUDGET ALLOTED : <b>" + f3 + "</b><br>[/HTML] . How can i do that. Any help will be appreciated.
regards,
ajos
Expand|Select|Wrap|Line Numbers
  1.  <%=f3%>

Also have a google at Java's naming and code conventions. I'm sure you'll find them instructive.
Nov 19 '07 #2
ajos
283 Contributor
Expand|Select|Wrap|Line Numbers
  1.  <%=f3%>

Also have a google at Java's naming and code conventions. I'm sure you'll find them instructive.
Thanks for the response...that s what we do to display the value....But my problem is how to bring the value of float f3 to be displayed in a jsp page....for example...for a property in a form viz username to be dispayed we write something like this is form bean--->
Expand|Select|Wrap|Line Numbers
  1. setUsername(String username)
  2. and getUsername();
  3.  
and in jsp page we do something like
Expand|Select|Wrap|Line Numbers
  1. formbean.getParameter("username")
  2. <%=username%>
  3.  
something like this. I hope you got my point.
Nov 19 '07 #3
r035198x
13,262 MVP
Thanks for the response...that s what we do to display the value....But my problem is how to bring the value of float f3 to be displayed in a jsp page....for example...for a property in a form viz username to be dispayed we write something like this is form bean--->
Expand|Select|Wrap|Line Numbers
  1. setUsername(String username)
  2. and getUsername();
  3.  
and in jsp page we do something like
Expand|Select|Wrap|Line Numbers
  1. formbean.getParameter("username")
  2. <%=username%>
  3.  
something like this. I hope you got my point.
Sorry I don't get your point ...
The float f3 will be displayed on the JSP page if you put the code I posted above in the JSP.
Nov 19 '07 #4
ajos
283 Contributor
Sorry I don't get your point ...
The float f3 will be displayed on the JSP page if you put the code I posted above in the JSP.
Ok. by writing <%=f3%> i can display the value. But the code
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2. float f3 = double1.floatValue();
  3.  
is in my servlet class. How do i set and get here in order to display it in my jsp page. Hope you get me this time:)
Nov 19 '07 #5
r035198x
13,262 MVP
Ok. by writing <%=f3%> i can display the value. But the code
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2. float f3 = double1.floatValue();
  3.  
is in my servlet class. How do i set and get here in order to display it in my jsp page. Hope you get me this time:)
You have to pass the value to the JSP then using request.setAttr ibute or the session attribute.
Nov 19 '07 #6
ajos
283 Contributor
You have to pass the value to the JSP then using request.setAttr ibute or the session attribute.
Ive done something like this in my servlet--->
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2.             float f3 = double1.floatValue();
  3.             httpservletrequest.setAttribute("f3", f3);
is this way right?
now how do i retrieve the value in jsp page?
Nov 19 '07 #7
r035198x
13,262 MVP
Ive done something like this in my servlet--->
Expand|Select|Wrap|Line Numbers
  1. Double double1 = new Double(s18);
  2.             float f3 = double1.floatValue();
  3.             httpservletrequest.setAttribute("f3", f3);
is this way right?
now how do i retrieve the value in jsp page?
Expand|Select|Wrap|Line Numbers
  1. request.setAttribute("name", value);
Then in the JSP you use
Expand|Select|Wrap|Line Numbers
  1. request.getAttribute("name");
Nov 19 '07 #8
ajos
283 Contributor
Expand|Select|Wrap|Line Numbers
  1. request.setAttribute("name", value);
Then in the JSP you use
Expand|Select|Wrap|Line Numbers
  1. request.getAttribute("name");
I did something like this
Expand|Select|Wrap|Line Numbers
  1. <%request.getAttribute("f3"); %>
  2. BUDGET ALLOTED : <b> <%=f3 %> </b><br>
  3.  
I think its wrong coz f3 is not recognized here.Or am i doing something wrong here?
Nov 19 '07 #9
r035198x
13,262 MVP
I did something like this
Expand|Select|Wrap|Line Numbers
  1. <%request.getAttribute("f3"); %>
  2. BUDGET ALLOTED : <b> <%=f3 %> </b><br>
  3.  
I think its wrong coz f3 is not recognized here.Or am i doing something wrong here?
Of course it's not.
You need to declare it with something perhaps like

Expand|Select|Wrap|Line Numbers
  1. String f3 = request.getAttribute("f3");
P.S Please do not ignore my earlier comment about having a look at code conventions.
Nov 19 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3883
by: Hai Tran | last post by:
Any help is appreciated. Installed Tomcat 4.1 and Mysql on a WinXP. I've manage to get Tomcat up and was able to view my first application ( myhome ) simple home page. Tomcat was installed under C:\Tomcat4\ with C:\Tomcat4\webapps\myhome\WEB-INF\classes to store all my java.class files. Under WEB-INF, I've have edit the web.xml file as ...
1
5965
by: efiedler | last post by:
Hi - I have the following input field on my html page: <input type="image" name="submit" id="submit" src="c:\image.jpg" value="image.jpg"> I also have another input field on the form that is a text box. When submitted my form posts its data to a servlet. I can click on the image, and the form is posted and the servlet is ran. However, I...
3
2838
by: rajarya | last post by:
Hi, I m designing a HTML page(index.html),here i have 2 frames,by defult both frames have index1.html and index2.html as their source . in first frame(index.html) ,i have some redio buttons,and a submmit button. so when I select one ption and click the submit button in the left side frame(or frame 1 or in index1.html) my right side frame...
2
3893
by: zoeabraham | last post by:
I am Using STRUTS1.4 in NetBeans5.5 IDE Here we have a JSP Page <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <%@ taglib...
1
2137
by: shiyamala | last post by:
Hi i am shiyam, i am having some problem in java, i am basic java programmer. i have to write one program is writing the data into textfile name "newfile.txt" from one servlet and read it from another servlet its work but i want to know hw to deploy the readed input from textfile is displayed in jsp through servlet2. here is my code import...
2
3245
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button...
3
3079
by: vijaykumardahiya | last post by:
Hello To Every One, I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic. I read the FileUpload Home page.But I am still confused. Is that true that file uploaded image can not show on servlet.Its store to database or memory..?? Please assist me. Thanks.
2
2598
by: sumanta123 | last post by:
Dear Sir, In my develpment i am getting stuck for a senario.Kindly please help me for it. Everytime we give the request we get the response of 8 records and its corresponding value. Then next button will display more and more records if it is availbale in data base. I am attachcing the screen shoot of my problem CMP is a column in the...
1
2616
by: jeddiki | last post by:
Hello, I have made a nice opt-in form and tested it in Moz FF and it looks fine. But in IE the elements don't line up properly. I think I am nearly there but can not get these elements straight - can you see what I have missed ?
0
7814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7576
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5443
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5165
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3583
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3564
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1147
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.