开发者

jsp - how can I out.println from within the head of an jsp page?

开发者 https://www.devze.com 2023-01-25 15:54 出处:网络
I have a website that Im trying to start - but I stored all of the information in a database.What I want to do, is create the page directly from the data in the database.

I have a website that Im trying to start - but I stored all of the information in a database. What I want to do, is create the page directly from the data in the database.

What Im struggling with is writing a database query to grab the page title from the database开发者_运维知识库, and plop it into the tag area.

Only when I open the database, and out.println the value to appear within the tag, nothing appears on the page in the title area. There are no page errors, I access the database successfully in the remaineder of the document...

is there something special I need to do to make this work?

thanks


Your result set might be returning empty title that is why you can't see otherwise, you should be able to view it or try <%=titlex %> beside println. Also, try to print the result to your log and try not to use System.out.println method because this does not all the time print to the log and instate use logger class methods like info or warning. Write a debugging line in page body too. If this doesn't work than definitely you not properly reading from the database or not writing DB value to an object if there is any.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号