我开发一个jsp系统时碰到的问题
1.No getter method for property name problem(struts)
有一种可能是Bean没有写相应的get方法,例如变量userName的get方法是getUserName;
还有就是这个Bean为空;
2.
MyEclipse的自动添加struts和hibernate功能不能返回,请注意!
所以我先使用MyEclipse导入struts和hibernate,然后将它们的jar导入到另外一个新建的工程,这是我就不需要Myeclipse来给我管理依赖了。
3
.在增加对struts taglib支持时,请将对应的tld文件追加到web.xml文件中去:
例如:
<jsp-config>
<taglib>
<taglib-uri>http://struts.apache.org/tags-bean </taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld </taglib-location>
</taglib>
</jsp-config>
4.
如果出错说某个tag在tld文件中没有,则说明自己在jsp文件中使用的tag和使用的struts taglib版本不一致
例如:在struts1.1中的html:locale,在struts1.2中改为html:lang
5.
struts tag中可以使用scriptlets,但是在scriptlets中不能使用struts tag。
Any Struts tag will work only if you place it directly in the JSP, not if you generate it through a scriptlet. To understand why it won't work to generate it in a scriptlet.
JSP life cycle:
* The JSP interpreter reads the JSP file, including any custom tags such as Struts tags and converts everything to Java source code
* It then compiles it into a class file
* It executes the code, rendering a response in plain HTML and sending it back to the browser.
* It is only at this point that the scriptlet code you inserted gets executed. It is now too late in the cycle to insert any custom tags, since they've already been interpreted by this point.
6. it is illegal according to JSP specification to nest one tag within another as an attribute.
There are two options:
1) You evaluate bean:write and then substitute it into html:text.
2) Use Struts-EL tags. They let you use expression language to get a bean value and substitute it in another tag.
Unless yo
相关文档:
在开发中验证码是比较常用到有效防止这种问题对某一个特定注册用户用特定程序破解方式进行不断的登陆尝试的方式。
此演示程序包括三个文件:
1.login.jsp:登录页面
2.code.jsp:生成验证码图片页面
3.check.jsp:验证结果
code.jsp
程序代码 ==================================================
<%@ page co ......
JSP页面跳转大全
JSP中的跳转:
(1). forward()方法
使用到javax.servlet.RequestDispatcher类
RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
rd.forward(requestVar,requestVar); //传递servlet的入口参数
......
一) 安装JDK(jdk-1_5_0-windows-i586.exe),默认安装;
(二) 安装Tomcat(tomcat5.5-installer.exe),默认安装;
* 顺序不可以颠倒 *
(三) 测试安装结果
1. 打开浏览器输入http://localhost:8080,如果成功,则会看到欢迎页面。此时访问的路径为$tomcat/webapps/root/
(四) 建立我的站� ......
index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......
以前用WSAD wizard做的,都可以在JSP页面中解析到EL表达式,当然前提是JSP2.0的情况下。
今天遇到了一个莫名其妙的问题。刚下载Eclipse3.3+MyEclipse6.0体验的过程中,遇上了解析不到EL表达式的问题。经过好几个小时的琢磨终于发现了,给大家share一下:
问题就出在建Web Project的时候web.xml声明上。
web.xml ......