Development of Flex Blog system from zero based on FLEX4 technology: 8 using JSP and JSTL

Source: Internet
Author: User

One, using JSP

APP Engine Java provides almost complete support for JSP,JSTL. This lesson mainly describes how to use JSP and Jstl in Gae for Java.

Open the Eclipse menu->preferences->java->installed JREs, add the JDK installation directory, and set it to default. The default eclipse points only to the JRE directory.

Open the Gapp_flexblog project and add the JSP file greeting_via_jsp.jsp under the war directory as follows:

<% @page contenttype= "Text/html;charset=utf-8" language= "java"%>
<% @page import= "Sban.flexblog.HelloWorldUsingJPA"%>
<% @page import= "Sban.flexblog.GreetingEntity"%>
<% @page import= "Java.util.List"%>
<body>

<%
if (null!= request.getparameter ("message"))
{
String action = request.getparameter ("message");
Response.getwriter (). Write (action + "<br/>");
}
%>

<form action= "/gapp_flexblog/hello" method= "POST" >
User:<input name= "username" value= "Sban" maxlength= "></input><br/>"
Greeting Content:<input value= "greeting content1" name= "Greetingcontent" maxlength= "the" "></input><br" />
<input type= "hidden" name= "action" value= "new"/>
<input type= "Submit" value= "Post greeting"/>
</form>

<div>
<form action= "/gapp_flexblog/hello" method= "POST" >
<input type= "Submit" value= "Delete all Greetings"/>
<input type= "hidden" name= "action" value= "Delall"/>
</form>
</div>

<div>
<ul style= "List-style:decimal;" >
<%
HELLOWORLDUSINGJPA operator = new HELLOWORLDUSINGJPA ();
list<greetingentity> greetings = operator.getallgreetings ();

if (greetings.size () > 0)
{
for (greetingentity greeting:greetings)
{
%>
<li>
id:<%= Greeting.getid ()%>
user:<%= Greeting.getuser ()%>
greetingcontent:<%= greeting.getgreetingcontent ()%>
Date: <%=greeting.getdate (). toString ()%>
</li>
<%
}
}else{
%>
<li>Empty!</li>
<%
}
%>
</ul>
</div>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.