Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display text from MySQL Text Field

 
M M Farhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is rowSrearch?
 
M M Farhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
rowSearch is a forEach variable:
<c:forEach var="rowSrearch" items="${rsSrearch.rows}" varStatus="stat">
</c:forEach>

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, what is it? A bean? A map? A hen's tooth?
 
M M Farhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advoice. But where should i post this message now to have a solution?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic