开发者

Java question about Servlet and JSP

开发者 https://www.devze.com 2023-03-08 01:27 出处:网络
How to use new line character in servlet with out.println(\"\\n Organization_name:\"); Is it right? but not getting desired o/p.

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?


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.


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>
0

精彩评论

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