Hi friends,
The situation is, in my class i have certain float parameters like---> - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
and s18 is--> s18 = resultset.getString("Budget_Alloted");
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
11 7665
Hi friends,
The situation is, in my class i have certain float parameters like---> - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
and s18 is--> s18 = resultset.getString("Budget_Alloted");
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
Also have a google at Java's naming and code conventions. I'm sure you'll find them instructive.
Also have a google at Java's naming and code conventions. I'm sure you'll find them instructive.
Thanks for the response...thats 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---> - setUsername(String username)
-
and getUsername();
-
and in jsp page we do something like - formbean.getParameter("username")
-
<%=username%>
-
something like this. I hope you got my point.
Thanks for the response...thats 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---> - setUsername(String username)
-
and getUsername();
-
and in jsp page we do something like - formbean.getParameter("username")
-
<%=username%>
-
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.
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 - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
-
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:)
Ok. by writing <%=f3%> i can display the value. But the code - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
-
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.setAttribute or the session attribute.
You have to pass the value to the JSP then using request.setAttribute or the session attribute.
Ive done something like this in my servlet---> - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
-
httpservletrequest.setAttribute("f3", f3);
is this way right?
now how do i retrieve the value in jsp page?
Ive done something like this in my servlet---> - Double double1 = new Double(s18);
-
float f3 = double1.floatValue();
-
httpservletrequest.setAttribute("f3", f3);
is this way right?
now how do i retrieve the value in jsp page?
- request.setAttribute("name", value);
Then in the JSP you use - request.getAttribute("name");
- request.setAttribute("name", value);
Then in the JSP you use - request.getAttribute("name");
I did something like this - <%request.getAttribute("f3"); %>
-
BUDGET ALLOTED : <b> <%=f3 %> </b><br>
-
I think its wrong coz f3 is not recognized here.Or am i doing something wrong here?
I did something like this - <%request.getAttribute("f3"); %>
-
BUDGET ALLOTED : <b> <%=f3 %> </b><br>
-
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 - String f3 = request.getAttribute("f3");
P.S Please do not ignore my earlier comment about having a look at code conventions.
Of course it's not.
You need to declare it with something perhaps like - String f3 = request.getAttribute("f3");
P.S Please do not ignore my earlier comment about having a look at code conventions.
Ok. I did as you said but we cannot convert from object to float.
like - <%float f3=request.getAttribute("f3"); %>
-
BUDGET ALLOTED : <b> <%=f3 %> </b><br>
I had tried this way earlier too. As for the naming conventions goes, this project is not done by me, ive told to make certain modifications in them, so i cant really change what the original developer has done, but i agree with you the naming conventions are horrible.
Ok. I did as you said but we cannot convert from object to float.
like - <%float f3=request.getAttribute("f3"); %>
-
BUDGET ALLOTED : <b> <%=f3 %> </b><br>
I had tried this way earlier too. As for the naming conventions goes, this project is not done by me, ive told to make certain modifications in them, so i cant really change what the original developer has done, but i agree with you the naming conventions are horrible.
request.getAttribute returns an object. You have to cast it to the type that you want.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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"...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |