JDeveloper editing JSP with Struts tags terribly, terribly slow!?
I use JDeveloper 10.1.2 and I do not know the reason but it started to take 15min just to change/edit JSP containing Struts tags. RAM memory is 1GB and there is more than 0.5 GB available, but processor usage shows 100% allocated to JDeveloper!? As soon as I do even slight change in a JSP file JDeveloper starts some computations and I have no idea of what it is doing.
What is JDeveloper computing? It seems it tries to produce some drop-down lists "helping" me to do the editing, add tags and instead I am spending days to just change one small JSP page!
How can I stop and PREVENT JDeveloper doing ANY "help" during editing of ANY file?
There must be an option to switch off whatever JDeveloper is doing?
Many thanks,
I did that but it is still very slow, it looks like Jdev is doing some intensive calculations whenever I click somewhere on JSP page with tags. Maybe this is related with my other question I posted before this one? Maybe JDev automatically searches for tag libraries it cannot find and copies them to /WEB-INF directory? (other IDEs used in same environment, like Eclipse and IntelliJ, and they do not have this problem)
Some other strange things: struts-config.xml seems not integrated with CVS from JDev (other files like tiles-config.xml, web.xml etc. are integrated, I can right click and get CVS info on particular file, except struts-config.xml). When I want to check in/out struts-config.xml I have to do it with external tool like WinCVS etc., cannot do that from JDev!
Similar Messages
-
Problem compling JSP with struts tags on Weblogic 8.1
I have deployed a web application in Weblogic 8.1. However, I am facing a problem while the JSPs are getting compiled. The JSPs ahve taglib declarations referring to Struts tag library files that are present in WEB-INF folder.
Stacktrace:
C:\java\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_epgonline_epgonline\jsp_servlet\_approve\__approve_home.java:209: cannot resolve symbol
probably occurred due to an error in /approve/approve_home.jsp line 53:
<logic:notPresent name="<%=JobBean.ID%>" scope="request">
C:\java\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_epgonline_epgonline\jsp_servlet\_approve\__approve_home.java:209: cannot resolve symbol
symbol : variable EVAL_BODY_BUFFERED
location: interface javax.servlet.jsp.tagext.BodyTag
if (_int0 == BodyTag.EVAL_BODY_BUFFERED) { //[ /approve/approve_home.jsp; Line: 53]
I believe other people have also faced this issue with Weblogic8.1 and struts. Any solutions???
Thx
KPKP,
Does this code run in the development environment but not in production? How
was this code compiled?
- john
"KP" <[email protected]> wrote in message
news:405b9b56$[email protected]..
I have deployed a web application in Weblogic 8.1. However, I am facing aproblem while the JSPs are getting compiled. The JSPs ahve taglib
declarations referring to Struts tag library files that are present in
WEB-INF folder.
Stacktrace:
C:\java\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\m
yserver_epgonline_epgonline\jsp_servlet\_approve\__approve_home.java:209:
cannot resolve symbol
probably occurred due to an error in /approve/approve_home.jsp line 53:
<logic:notPresent name="<%=JobBean.ID%>" scope="request">
C:\java\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\m
yserver_epgonline_epgonline\jsp_servlet\_approve\__approve_home.java:209:
cannot resolve symbol
symbol : variable EVAL_BODY_BUFFERED
location: interface javax.servlet.jsp.tagext.BodyTag
if (_int0 == BodyTag.EVAL_BODY_BUFFERED) { //[/approve/approve_home.jsp; Line: 53]
>
I believe other people have also faced this issue with Weblogic8.1 andstruts. Any solutions???
>
Thx
KP -
Help: OJSPC can not compile the JSP with struts tag
Hi,
I am trying to precompile the JSP page with EAR package but OJSPC can not parse the Struts tags.
I always get oracle.jsp.parse.JspParseException:
Error: org.apache.struts.taglib.html.MessgesTei while reading TLD /WEB-INF/tld/struts-html.tld
My OC4J version is 10.1.3.2 and I did tried putting the struts-taglib.jar to /opt/oracle/product/app10g/j2ee/home/jsp/lib or /lib/taglib
but still do not work.
Can anyone tell me how to configure the OJSPC and let it support customerized taglibs?
Thanks a lot!This is a new problem with jdk1.4 when compiling with tomcat.
The solution is to ensure that any classes in WEB-INF/classes are in a package structure and the relevant jsp calls the same using the package name.
best
kev -
Error while running JSP with custom tag
I am trying to run a jsp with a tag and I am getting the following error when I run the jsp:
"Unable to open taglibrary /WEB-INF/jsp/mytaglib.tld : Parse Error in the tag library descriptor: External parameter entity "%(DOCTYPE);" has characters after markup."
I have no idea what this is, can anyone help me here?
tx
-ABIts difficult to tell without looking at your TLD file i.e. mytaglib.tld
However, a guess is that you may be refering to an invalid or otherwise corrupted DTD from your TLD.
Check that out.
The official DTD for TLDs in JSP 1.1 is http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
and the official DTD for TLDs in JSP 1.2 is http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd -
Jsf 1s phase of life cycle how knows ths components of the jsp with jsf tag
i wish to know how faces servlet knows the jsp s view components while creaTI NG component tree at first request to input jsp which may have jsf tags.in the first phase faces servlet doesnot know input jsp with jsf tags what componnets it has. it is actually atthe response send or forward time which is the final phase when the tag ge executed and output is sent to client.i did understandin jsf life cycle in 1 st phase component tree is created at first request in 1 st phase .
Hi,
though a FacesContext holds the values used by a request, it doesn't mean it lives for as long as the request. The best explanation I found is from the JavaDocs
release
public abstract void release()
+Release any resources associated with this FacesContext instance. Faces implementations may choose to pool instances in the associated FacesContextFactory to avoid repeated object creation and garbage collection. After release() is called on a FacesContext instance (until the FacesContext instance has been recycled by the implementation for re-use), calling any other methods will cause an IllegalStateException to be thrown.+
The implementation must call setCurrentInstance(javax.faces.context.FacesContext) passing null to remove the association between this thread and this dead FacesContext instance.
Throws:
java.lang.IllegalStateException - if this method is called after this instance has been released
Frank -
WLS 8.1 sp1 with Struts 1.1 JSP with bean tag won't compile
Hello,
We are currently porting our application which uses struts 1.1 to WLS 8.1 sp1
from another app server. Everything seems to deploy correctly and pages which
use struts tags appear to compile and run fine. However, the pages with struts
<bean:define> tags are not compiling.
Example JSP Code:
<bean:define id="userForm" name="userForm" scope="session" toScope="page" type="UserFormBean"/>
<% if (userForm.hasUserData()) {hasUser=true;} %>
WLS Console Output:
..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
symbol : variable userForm
location: class jsp_servlet._jsp._sailor.__home
if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line: 38]
When I look at the JSP's parsed java code (__home.java:493) I find that nowhere
in the class is the variable userForm declared.
Is this a bug in WLS? Does anyone know of a workaround?
Thanks,
Scott
Please contact customer support [email protected] and request a patch for
CR112789. AT_END tags do not work correctly in 81sp1
--Nagesh
"Scott Fleming" <[email protected]> wrote in message
news:3f734c0d$[email protected]..
>
> Hello,
>
> We are currently porting our application which uses struts 1.1 to WLS 8.1
sp1
> from another app server. Everything seems to deploy correctly and pages
which
> use struts tags appear to compile and run fine. However, the pages with
struts
> <bean:define> tags are not compiling.
>
> Example JSP Code:
>
> <bean:define id="userForm" name="userForm" scope="session" toScope="page"
type="UserFormBean"/>
>
> <% if (userForm.hasUserData()) {hasUser=true;} %>
>
> WLS Console Output:
>
> ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
> symbol : variable userForm
> location: class jsp_servlet._jsp._sailor.__home
> if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line:
38]
>
> When I look at the JSP's parsed java code (__home.java:493) I find that
nowhere
> in the class is the variable userForm declared.
>
> Is this a bug in WLS? Does anyone know of a workaround?
>
> Thanks,
> Scott
-
Help! Problem with Struts tag html:errors/
Hi everybody,
In my JSP page called addUser.jsp, i have the different Struts Tag
<html:errors/>
<html:form action="/addUser" focus="firstName">
</html:form>
I have of course the ApplicationResources.properties file with differents Struts properties:
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
errors.ioException=I/O exception rendering error messages: {0}
and an other one:
error.fieldsNeeded=<font color="#FF0000">Some fields are missing.</font>
when I call the addUser form, my JSP page display:
null Some fields are missing. null
Have u any suggestion about my prob?
tx a lot
s.Hi,
can u post the java code where u are actually adding the error to the action errors. may be there is something wrong with that. I dont see any problem with the jsp or the applicationsResources.properties.
Thanks
Latha -
Hi,
I am new to struts and am getting confused with the tags.
I have few doubts.
My Actionform would be -
public class AForm extends ActionForm {
//~ Instance fields ********************************************************
String deptNo;
String dName;
String loc;
//~ Methods ****************************************************************
* This function
* @param deptNo DOCUMENT ME!
public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
* This function
* @return DOCUMENT ME!
public String getDeptNo() {
return deptNo;
}In my action class I say -
selectSql = "SELECT DEPTNO FROM DEPT";
pStmt = conn.prepareStatement(selectSql);
theResultSet = pStmt.executeQuery();
ArrayList _arrayList = new ArrayList();
while (theResultSet.next()) {
AForm theAForm = new AForm();
theAForm.setDeptNo(theResultSet.getString("DEPTNO"));
_arrayList.add(theAForm);
req.setAttribute("arrayListOfDeptnos", _arrayList);My question is -
How do I get this arraylist in the JSP and iterate through it? Should I code in this way? Is there an more elegant way to do it??
My JSP page
<%
java.util.ArrayList ss = (java.util.ArrayList)request.getAttribute("arrayListOfDeptnos");
if(ss!=null){
%>
<logic:iterate id="booId" scope="request" collection="<%=ss%>" type="mypackage27.AForm">
<html:link action="/getme" paramId="theNum" paramProperty="deptNo" paramName="booId">
<bean:write name="booId" property="deptNo"/>
</html:link>
</logic:iterate>
<%
%>I know this must be very trivial ...Rather than using collection attribute (which requires a runtime expression) instead use the name attribute.
Also, if you aren't going to use the variable "booId" in scriptlet code/expressions, you can leave out the "type" attribute.
Probably the scope attribute as well.
That all boils down to:
<logic:iterate id="booId" name="arrayListOfDeptnos">
<html:link action="/getme" paramId="theNum" paramProperty="deptNo" paramName="booId">
<bean:write name="booId" property="deptNo"/>
</html:link>
</logic:iterate>And for completeness, the same thing using some JSTL code:
<c:forEach var="booId" items="${requestScope.namearrayListOfDeptnos}">
<html:link action="/getme" paramId="theNum" paramProperty="deptNo" paramName="booId">
<c:out value="${booId.deptNo}"/>
</html:link>
</c:forEach>Cheers,
evnafets -
hello,
i'm building a web-application with struts. now i have the following problem (i don't find den reason, although i'm trying for hours):
i want to show in the browser (with tomcat) a jsp-site. this site consists of different jsp-parts:
file neujob.jsp
<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<template:insert template='/templates/eshop.jsp'>
<template:put name='header' content='/templates/header.jsp' />
<template:put name='view' content='/view/erstellen.jsp' />
<template:put name='footer' content='/templates/footer.jsp' />
</template:insert>
header and footer are shown correctly, when i call http://localhost:8080/pmtool/neujob.jsp in the browser; but the view-part is not shown. independent of how it looks. even this narrow-version doesn't work:
file erstellen.jsp
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
huhu<br>
huhu<br>
the login.jsp-site however is shown correctly, and actually it is built similarly.
what may be the reason? what gets wrong?
thank you for your help!
paraphrasesorry! now i've found my mistake!
-
Hello Friends,
I'm very new to struts, and have a code piece that does the following:
<logic:iterate id="paramData" name="<%=printParam%>" >
<PARAM NAME = "<bean:write name="paramData" property="key" />" VALUE="<bean:write name="paramData" property="value" />">
<PARAM NAME = "rootUrl" VALUE="<%=HttpUtil.getServerUrl(request)%>" >
</logic:iterate>
It iterates through a Map and gets the values in the applet. However I now have to change this so that it gets the applet params from a ParamsVO.java, a value object. How does the code change to get the values now?
I have paramsvo.getXXX methods that I can use. Though not sure how they are used with struts. Pls help!!
KarenAll the parameters are in this ParamsVO object? Each with their own getter/setter?
I don't think you are able to do this in a loop.
You just have to write a <PARAM> tag for each property, and get its value.
For instance if paramsVO has getParam1() method
<PARAM NAME="param1" VALUE="<bean:write name="paramVO" property="param1"/>">
Cheers,
evnafets -
Trying to submit back to jsp with struts
Ok, so I have a jsp page that displays tons of stuff.
I get there from the struts flow of:
InputFormJsp -> strutsFormBean ->strutsActionBean->JSP View Page
So I'm at my view page and I was to resubmit back to the view page again using a bunch of hidden input fields to redo the page with different vars (historic data, based on the 1st time through).
So it will go:
JSP View Page->strutsFormBean->strutsActionBean->JSP View Page
I want to use the same form and action beans and the same view page, just want to pass the hidden vars instead of prompting the user all over again.
I have my form and hidden fields set up, but my problem is how do I get struts to see the resubmit. I made a new actionmapping that labeled the "input" as the same jsp page as the forward but I keep getting:
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)followed by a good old NullPointerException from my actionbean's execute method (I think):
root cause
java.lang.NullPointerException
com.air2web.SysReportAction.execute(SysReportAction.java:85)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)struts-config.xml looks like:
<action path="/getSysReport"
type="com.air2web.SysReportAction"
name="SysReportForm"
input="/pages/SysReport.jsp"
scope="request">
<forward name="success" path="/pages/genSysReport.jsp"/>
</action>
<action path="/getSysReportHistoric"
type="com.air2web.SysReportAction"
name="SysReportForm"
input="/pages/genSysReport.jsp"
scope="request">
<forward name="success" path="/pages/genSysReport.jsp"/>
</action>Is there a way to specify many input pages or some other trick to do this??
Thanks
Chris LilesI had exactly the same problem with Struts, and Finally I solve this.
first of all put into <form-beans> the form path
<form-bean name="updUserForm" type="com.yourcompany.struts.form.UpdUserForm" />and in <action-mappings >
<action
attribute="updUserForm"
input="/UpdateUser.jsp"
name="updUserForm"
path="/updUser"
scope="request"
type="com.yourcompany.struts.action.UpdUserAction" >
<forward name="success" path="/MyJsp.jsp" />
</action>Be carefull with the first letter of attribute and name they must be in minus! (Instead of mayus in form).
For more ..
[email protected] -
JSP with Custom tags error during verify.
Hi, i am new to JSP and Custom tag Library. The tools that i am using to deploy is "Sun Deploy Tool 8.2" with Sun Application Server. When i try to verify my JSP page i get this error message
tests.web.AllJSPsMustBeCompilable . I guess there is nothing wrong for my code, will it be path problem, because
i already check that i had included all the path that i need. Any idea what might cause this problem? Thank You.
Assertion:All the JSPs that are bundled inside a web application must be compilable using a J2EE compliant JSP compiler that does not have any proprietary or optional features in it.
For [ /tag/tag.war ]
Error: Some JSPs bundled inside [ tag ] could not be compiled. See details below.
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 12 in the jsp file: /currentTime.jsp
Here are my class file :
Custom lib java Class timetag.java
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.text.SimpleDateFormat;
public class timetag extends TagSupport{
public int doEndTag() throws JspException
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("HH:mm:ss");
String time = sdf.format(new java.util.Date());
try {
pageContext.getOut().print(time);
}catch(Exception ex)
throw new JspException(ex.toString());
return EVAL_PAGE;
Tag file *.tld : examplesTag.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>1.0</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>ExamplesTags</short-name>
<description>A set of example tag handlers.</description>
<tag>
<name>time</name>
<tag-class>timetag</tag-class>
</tag>
</taglib>
JSP File : currentTime.jsp
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="examples" uri="/WEB-INF/examplesTags.tld" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<examples:time /> //If i remove this it will be fine.
</body>
</html>I am sorry for the double post because the format mess up..Please ignore this POST..Apologies again..Thanks
-
Help running a simple jsp (with struts and core -sun- taglibs)
Hi, could somebody help me with this simple JSP?
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:html="http://struts.apache.org/tags-html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<html:text property="text">text</html:text>
<label>hello</label>
<c:forEach begin="1" end="5">
<label>inside</label>
</c:forEach>
</body>
</html>When I run it, the c:forEach tag doesn’t work.
Output shows “text hello inside” instead of desired “text hello inside inside inside inside inside”
Any hints will be really appreciated.
Edited by: 792625 on 03-sep-2010 0:15Add the JSTL Core tag library.
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> -
JDeveloper 9i - Problem with using tag lib
I am having problem with building my project, using JDeveloper 9i.
My project includes custom tag libraries.
When I build my project, I get back the following error:
Error(1): oracle.xml.parser.v2.XMLParseException: Invalid element 'servlet' in content of 'web-app', expected elements '[error-page, taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'
for every jsp file that has the taglib directive as follows:
<%@ taglib prefix="srp" uri="/srpTagLib" %>
Please note that the application runs OK, but it can not be build by JDeveloper for debugging purpose.
Any ideas? Please help!!!!
Thanks,
CathyWhat version is your tag library and what version is your deployment descriptor?
-
Question in developing JSP with Struts
Hello,everybody.
Recently,I wrote a simple JSP Web program basing on the Struts architecture.It created a page for a user to input his name and password,and after the user click the submit botton on the form,it can redirect to another page and show the name and password that the use has input on the page.I have completed the program but it can't work properly.
I listed each part of the program as following:
(a) TestForm.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>Login Interface</title>
</head>
<body vLink="#006666" link="#003366" bgColor="#E0F0F8">
<img height="33" src="image/enter.gif" width="148">
<form action="ReadTestForm.do" method="post">
UserName:
<input size="15"name="PersonName"><p>
Password:
<input type="password" size="15" name="Psw"><p>
<input type="submit" value="Submit">
</form>
(b) MTestForm.java
package Test;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
public class MTestForm extends ActionForm{
private String PersonName = null;
private String Psw = null;
public MTestForm(){}
public void setPersonName(String name) {
this.PersonName = name;
public String getPersonName() {
return PersonName;
public void setPsw(String psw) {
this.Psw = psw;
public String getPsw() {
return Psw;
public void reset(ActionMapping mapping,
HttpServletRequest request) {
this.PersonName = null;
this.Psw = null;
(c) ReadTestFormAction.java
package Test;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionMessage;
import javax.servlet.ServletContext;
import javax.sql.DataSource;
import javax.servlet.http.*;
public final class ReadTestFormAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
MTestForm TestFormBean = (MTestForm) form;
String PersonName = TestFormBean.getPersonName();
String Psw = TestFormBean.getPsw();
return mapping.findForward("ReadTestFormOk");
(d) ShowForm.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import = "classmate.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Read Test Form and Show the Data</title>
</head>
<body>
<%
MTestForm ReadformBean1 = (MTestForm)request.getAttribute("TestFormBean1");
%>
<h1><img src="image/smile.gif">
Welcome
<%=ReadformBean1.getPersonName()%>
Your Password is:
<%=ReadformBean1.getPsw()%>
</h1><br>
</body>
</html>
(e) web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>actionServlet</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>actionServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>TestForm.jsp</welcome-file>
</welcome-file-list>
</web-app>
(f) struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="formBean1" type="Test.UserForm"/>
<form-bean name="TestFormBean1" type="Test.MTestForm">
</form-bean>
<action-mappings>
<action path="/login" type="Test.LoginAction" name="formBean1" scope="request" input="/login.jsp" >
<forward name="failed" path="/error.jsp"></forward>
<forward name="successed" path="/right.jsp"></forward>
</action>
<action path="/regist" forward="/regist.jsp"/>
<action path="/ReadTestForm"
type="classmate.ReadTestFormAction" name="TestFormBean1" scope="request" input="/login.jsp">
<forward name="ReadTestFormOk" path="/ReadForm.jsp"></forward>
</action>
</action-mappings>
</struts-config>
After I accessed the page of "TestForm.jsp" and input the " Username and Password",click "Submit " button ,it can redirect to the page of "ShowForm.jsp",but each time both the Username and Password are "Null", It meaned that the statement {which is MTestForm ReadformBean1 = (MTestForm)request.getAttribute("TestFormBean1");
} and its following statement in the "ShowForm.jsp" can't accessed what the user have input for the Textboxs of Username and Password.
I have tried and tried and modify the program for many times,but it have not been solved.
Can you help me to check out what is the wrong with the program?
Thanks you for help and Regards
(Can you anybody tell me how edit the text so that it can been printed out clearly in this forum?)
Message was edited by:
DevemorWell as far as i see there is no mapping working between
Form input and ActionForm Bean properties as the reset() method would be called b4 action class
you need to map the properties in the below fashoin
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head> <title>Login Interface</title> </head>
<body vLink="#006666" link="#003366" bgColor="#E0F0F8">
<img height="33" src="image/enter.gif" width="148">
<form action="ReadTestForm.do" method="post">
UserName: <input size="15"name="PersonName">
Password: <input type="password" size="15" name="Psw">
<input type="submit" value="Submit">
</form>
</body>
</html>MTestForm.java:
==============
package Test;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
public class MTestForm extends ActionForm{
private String PersonName = null;
private String Psw = null;
public MTestForm(){}
public void setPersonName(String name) { this.PersonName = name; }
public String getPersonName() { return PersonName; }
public void setPsw(String psw) { this.Psw = psw; }
public String getPsw() { return Psw; }
public void reset(ActionMapping mapping, HttpServletRequest request)
{ this.PersonName = request.getParameter("PersonName");
this.Psw = request.getParameter("Psw");
}or try with
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<title><bean:message bundle="form" key="login.title"/></title>
</head>
<body>
<html:form action="">
Username : <html:text property="personName" />
Password : <html:password property="psw"/>
</html>
</body>
</html:html>MTestForm.java:
==============
package Test;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
public class MTestForm extends ActionForm{
private String PersonName = null;
private String Psw = null;
public MTestForm(){}
public void setPersonName(String name) { this.PersonName = name; }
public String getPersonName() { return PersonName; }
public void setPsw(String psw) { this.Psw = psw; }
public String getPsw() { return Psw; }
public void reset(ActionMapping mapping, HttpServletRequest request)
this.PersonName = null;
this.Psw = null;
}and the controller part would be something like the one below
ReadTestFormAction.java
=======================
package Test;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionMessage;
import javax.servlet.ServletContext;
import javax.sql.DataSource;
import javax.servlet.http.*;
public final class ReadTestFormAction extends Action{
public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
MTestForm TestFormBean = (MTestForm) form;
String PersonName = TestFormBean.getPersonName();
String Psw = TestFormBean.getPsw();
return mapping.findForward("ReadTestFormOk");
}struts-config.xml:
==================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="formBean1" type="Test.UserForm"/> <form-bean name="TestFormBean1" type="Test.MTestForm">
</form-bean>
<action-mappings>
<action path="/login" type="Test.LoginAction" name="formBean1" scope="request" input="/login.jsp" >
<forward name="failed" path="/error.jsp"></forward>
<forward name="successed" path="/right.jsp"></forward>
</action>
<action path="/regist" forward="/regist.jsp"/> <action path="/ReadTestForm" type="classmate.ReadTestFormAction" name="TestFormBean1" scope="request" input="/login.jsp"> <forward name="ReadTestFormOk" path="/ReadForm.jsp"></forward> </action>
</action-mappings>
</struts-config>Hope that might help :)
REGARDS,
RaHuL
Maybe you are looking for
-
Double_click and exit SAPLSLVC_FULLSCREEN in one step ?
I have a program where the user can click a function button on the selection screen to display a ALV list of all entries this user has made. From the ALV list, I want to allow them to double click a line and return the values to the selection screen
-
Backup startup external drives, disk utility, dmgs
Dear All, I am trying to backup my Mac Mini to a Firewire drive with an image file (dmg) using Disk Utility. But I get this error: "Unable to create dmg. Resource busy." That is due to my startup disk being my Mini which I'd like to backup. So I've t
-
Opening nikon d7000 raw files in pse8
I have downloades camera raw 6 plug in but I am still getting the wrong file type error when I try to open my nikon d7000 raw files in elements 8. any suggestions??
-
Cleaning Dell LCD Monitor - What are current recommendations?
What are the current recommendations for cleaning a Dell LCD Monitor? I have always used 50% distilled water and 50% isopropyl alcohol and gently cleaned with a microfibre cloth. We have many different Dell LCD monitors in my workplace. George
-
How to restore a previous version of lightroom database
I messed up and mistakenly removed an image from lightroom ... is there any way to recover that version of the image that was in the lightroom database via a restore process? I've been backing up the database each time I start the program. Thanks.