tejas26389
tejas26389

Reputation: 73

Java question about Servlet and JSP

How to use new line character in servlet with out.println("\n Organization_name:"); Is it right? but not getting desired o/p.

i want following,

Button b=new Button();
add(b);

how i can use above code in JSP?

Upvotes: 0

Views: 689

Answers (2)

ant
ant

Reputation: 22948

You can write java inline in your jsp page, i.e :

<HTML>
<BODY>
<%
    System.out.println( "Evaluating date now" );
    java.util.Date date = new java.util.Date();
%>
Hello!  The time is now <%= date %>
</BODY>
</HTML>

Upvotes: 0

Boris Pavlović
Boris Pavlović

Reputation: 64622

Insert a new line using HTML tag <BR/>:

out.println("<BR/>Organization_name:");

To have a button you need to define a form and an input field of a type submit:

<form name="input" action="action.jsp" method="get">
  Username: <input type="text" name="user" />
  <input type="submit" value="Submit" />
</form>

This HTML should be returned by the servlet or declared in the JSP page. Take a look at JSP Tag libraries which do a great job of returning correct HTML code for common web controls.

Upvotes: 3

Related Questions