File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Display text from MySQL Text Field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display text from MySQL Text Field" Watch "Display text from MySQL Text Field" New topic
Author

Display text from MySQL Text Field

M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
Hi,
I am trying to display text which is stored in mysql text field. But it displays nothing. and when i try this code:
<cut value="${rowSrearch.pDetails}" />
<c:set var="text" value="${rowSrearch.pDetails}"/>
<%
String text = (String)pageContext.getAttribute("text");
out.print(text);
%>

it gives me null.

What is the best way to retrieve data from MySQL text field.

I am using:
Apache2
Tomcat 5.5.17
MySQK 5.0.22
mysql-connector-java-5.0.3

Thanks

Regards,
Farhan
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

What is rowSrearch?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
Hi,
rowSearch is a forEach variable:
<c:forEach var="rowSrearch" items="${rsSrearch.rows}" varStatus="stat">
</c:forEach>

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

No, what is it? A bean? A map? A hen's tooth?
M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
It is not a bean or map.
It is:
"Name of the exported scoped variable for the current item of the iteration. This scoped variable has nested visibility. Its type depends on the object of the underlying collection."
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Yes, we all know what <c:forEach> does, copying snippets from the documention is not helpful.

If you are not going to tell us what the type of the object is, we cannot help you.
M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
I am not very experienced.
What i am not defining any variable in JSP/JSTL (except String text = (String)pageContext.getAttribute("text")). I am just opening a resultset using <sql:query and trying to retrieve data using <c:forEach loop.

How can i find the object type?

Thanks
M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
This is just for correction of sentence:
i am not defining any variable in JSP/JSTL (except String text = (String)pageContext.getAttribute("text")).

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Originally posted by M M Farhan:
I am just opening a resultset using <sql:query


OK, that's really important information that you should have included right off the bat. Now people that use the JSTL sql tags, may be able to help you.

Please read this for help in forumulating your posts.
M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
Thanks for the advoice. But where should i post this message now to have a solution?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This is the correct forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

I hope someone here can answer your question.

But I think you will find that very few, in particular the more experienced, web app developers condone the use of the SQL tags, preferring to structure their programs using best-practice MVC patterns.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display text from MySQL Text Field