• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3783
  • Last Modified:

How to write label in jsp?

Hi

I need to display a string value get from a parameter in a jsp page.

http://www.test.com/index.jsp?message=Welcome

How to display 'Welcome' in the jsp page? is it some kind like asp's label?
<%
if(request.getParameter("message")!=null){
String message = request.getParameter("message");
System.out.println(message); //how can i print it on a jsp page?
}
%>

Open in new window

0
techques
Asked:
techques
  • 3
  • 3
1 Solution
 
KuldeepchaturvediCommented:
<%
if(request.getParameter("message")!=null){
String message = request.getParameter("message");
out.println(message); //how can i print it on a jsp page?
}
%>

will put it on jsp page.
0
 
techquesAuthor Commented:
yes, I put it in jsp page already, but still cannot display
0
 
KuldeepchaturvediCommented:
the code above shd def show it on your web page..

if your jsp have nothing else but just this code...
it should display Welcome on the page...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
techquesAuthor Commented:
Yes, there is something else in the jsp page.

But, when the url returns
http://localhost:8080/test/index.jsp?msg=Welcome

The page does not display 'Welcome'.
Welcome display in console windows in eclipse.
<form name="loginjsp" action="login" method="post">
Email: <input type="text" name="email"><br>
Password: <input type="password" name="password"><br>
<input type="submit" name="Button" value="Login">
<%
if(request.getParameter("msg")!=null){
String msg = request.getParameter("msg");
System.out.println(msg);
}
%>
</form>

Open in new window

0
 
KuldeepchaturvediCommented:
you need to change

System.out.println(msg);

to
out.println(msg);

System.out is console

out is the printwriter back to jsp
0
 
techquesAuthor Commented:
oh, sorry for my fault. I am a very newbie to jsp.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now