struts integrate with hibernate and spring

2014-10-19 Thread phoenix
I want to integrate struts2 with hibernate4 and spring4,but i don't know if  i 
need to use spring to manager struts action, is spring manager struts action 
better than struts manage action itself? Which method is better?  I am puzzled 
with how to integrate struts2 with hibernate4 and spring4, Anyone could give me 
whole code which i can learn and run struts2 with hibernate4 and spring4? 
Thanks.

Struts2+json question

2010-08-05 Thread red phoenix
I use struts2.1.8 and extjs3.2, I make a login page, if login
failed,it will alert a message and it will still stay this login page;
if it login success,it will go to another new page,such as main.jsp
page

My login page is follows:
var win=new Ext.Window({
  el:'hello-win',
   
  items:
  loginForm,
buttons:[{
   text:'OK',
   handler:function(){
 if(win.getComponent('loginForm').form.isValid()){
 win.getComponent('loginForm').form.submit({
   url:'/Test/test.do',
   success:function(form,action){
 Ext.Msg.alert("Login success!",action.result.message);
   },
  failure:function(form,action){
Ext.Msg.alert('Login fail",action.result.message);
  }
});
  }
   }
   }
   });

Action class is follows:
public String login() throws Exception{
   boolean success;.
   
   if(success){
 return SUCCESS;
   }
   else{
 setMessage("Your ID or password is wrong");
 return null;
  }
}

configure file is follows:

  
  
 
  
  


If I set main.jsp, when I click OK button,it will
raise javascript error,because extjs don't get json message.
If I set ,whether I login success or fail,the
login page will don't redirect,If login success,I want to redirect
this page to main.jsp,but it don't redirect.What can I do about
configure file? I don't know how to do it.I have no idea about it.
Any idea will be appreciated!

Thanks in advance

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts 2 + Spring 2 + JPA + AJAX question

2010-07-12 Thread red phoenix
I want to use Struts 2 + Spring 2 + JPA + AJAX,I find it as following url:
http://struts.apache.org/2.1.8/docs/struts-2-spring-2-jpa-ajax.html

When I try to download this code,like follows:
Get the 
code

   - Show me the
code

I get Page Not found error! Where can I get the code?

Thanks!


How to get s:select id and name under struts2 action?

2010-03-22 Thread red phoenix
I have a jsp,it contains a s:select,like follows:


When this jsp submit,it will submit to a struts2 action,I want to know how
to get all id and name of s:select and how to get selected id and name of
s:select ?
How to do it? An example is better.

Thanks!


legend don't work under of struts2

2010-03-13 Thread red phoenix
I want to use legend tag under struts2,I set legend css like follows:
form{
padding:10px;
margin:0 auto;
}
form#form legend {
border:1px solid #e8e7e1;
background:#fff url(../img/form_red.gif) repeat-x center left;
color:#a43708;
}

following code can run well:
Add user

  
 information
  


Then I use  to replace  tag,like follows:
Add user

  
 information
  


Then I find legend tag don't work! Why? How to correct above code to
make legned tag run again?

Thanks

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



struts2 show question

2009-04-20 Thread red phoenix
I have a table named mytable,it has two cols,col1 and col2,the data are
col1   col2
---
John   24
Kate   18

hibernate xml file is follows:

 
  
   
  
  
   
  
   


Then I user struts2 to get the data by following statement: List
testList=this.getHibernateTemplate().find(" from mytable");
request.setAttribute("testList",testList);
return SUCCESS;

the action dispatch to following jsp page



   

 
   



Above codes run well,it can show correct result
 John   24
Kate   18

then I modify struts action,like following:
 List testList=this.getHibernateTemplate().find(" select col1,col2 from
mytable");
request.setAttribute("testList",testList);
return SUCCESS;

the action dispatch to the same jsp,but this time,the jsp show nothing!
Why? I don't understand what's wrong with my code? Anyone could help me to
solve above problem?

Thank


How to set 'pager.offset' in struts2 action?

2009-03-09 Thread red phoenix
I use struts2 and Pager Taglib2.0, in jsp file,it has a parameter,like
follows:


when I run above code,it raise warning message:
Warn: ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'pager.offset' on 'class test.ArticleAction: Error setting
expression 'pager.offset' with value '[Ljava.lang.String;@16b69d7'

I want to know how to set 'pager.offset'  in struts2 action?

Thanks!


pager question in struts2+Pager Taglib2

2009-02-02 Thread red phoenix
I use struts2.0.14 and Pager Taglib2.0, I want to use Pager Taglib2.0 in
struts2

In action file
public String search() throws Exception{
  System.out.println("call search");
  
  request.setAttribute("index","center");
  request.setAttribute("pageUrl","/test/search.action");
  
  return SUCCESS;
}

in xml file

   /test/mypage.jsp
  

In jsp file




  <% if (pageUrl != null) { %>
http://www.google.com/nav_previous.gif alt="" border=0>
Previous
  <% } else { %>
http://www.google.com/nav_first.gif alt="" border=0>
  <% } %>


  <% if (pageNumber == currentPageNumber) { %>
http://www.google.com/nav_current.gif alt="">
<%= pageNumber %>
  <% } else { %>
http://www.google.com/nav_page.gif alt="" border=0>
<%= pageNumber %>
  <% } %>


  <% if (pageUrl != null) { %>
http://www.google.com/nav_next.gif alt="" border=0>
Next
  <% } else { %>
http://www.google.com/nav_last.gif alt="" border=0>
  <% } %>


When I run above code,it can run well,but when I click next page
button,tomcat raise a warning message:
Warn: No configuration found for the specified action: 'search' in
namespace: '/test/mypage'. Form action defaulting to 'action' attribute's
literal value.

Why raise above warning message? I guess when click next button,it should
call action search method,why it don't call it? How to correct above code?

Thanks!


How to decorate button

2008-12-30 Thread red phoenix
My Struts is 2.0.14,I use ,like follows:
 

Then there is a upload button,but this button is not pretty.I have two
question:
1) How to decorate this button,such as a image button?
2) when I click this button,how to check this upload file name first,if this
file name is DOC,it can submit,otherwise it will say not support other type
file?

Thanks


Re: org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

2008-12-16 Thread red phoenix
>How to look if I use the default stack? My configure file is follows:

   
   
   /demo/upload.jsp
  
  


Is it  "fileUpload" interceptor?

phoenix

On Tue, Dec 16, 2008 at 11:55 PM, Dave Newton  wrote:

> --- On Tue, 12/16/08, red phoenix wrote:
> > It says: Ensure that {{fileUpload }} Interceptor is included in the
> > Action's stack. .*The default stack already includes {{fileUpload }}.*
> >
> > I don't know how to determine 'Ensure that {{fileUpload }} Interceptor
> > is included in the Action's stack",which file? Would you give me a
> > example?
>
> ...
>
> The default stack already includes the "fileUpload" interceptor.
>
> Are you using the default stack?
>
> If yes: it already includes the "fileUpload" interceptor.
> If no: does *your* stack include the "fileUpload" interceptor?
>  If yes: you're done.
>  If no: include it.
>
> > My question is how to get upload stream when submit  jsp to
> > action, client and server are not the same machine. How to do it?
>
> The file is an action property: you can do whatever you want with it.
>
> Dave
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

2008-12-16 Thread red phoenix
>Use the *preferred* method, the interceptor.
It says:
Ensure that {{fileUpload }} Interceptor is included in the Action's stack.
  .*The default stack already includes {{fileUpload }}.*

I don't know how to determine 'Ensure that {{fileUpload }} Interceptor is
included in the Action's stack",which file? Would you give me a example?

By the way, I want to get upload stream as follows:
FileInputStream fis = ...  //how to get FileInputStream?
uploadaction.setData(Hibernate.createBlob(fis));

My question is how to get upload stream when submit  jsp to action, client
and server are not the same machine. How to do it? An example is better.

phoenix

On Tue, Dec 16, 2008 at 11:32 PM, Dave Newton  wrote:

> Use the *preferred* method, the interceptor.
>
> I haven't looked in to what caused the breaking change.
>
> Dave
>
> --- On Tue, 12/16/08, red phoenix  wrote:
>
> > From: red phoenix 
> > Subject: Re: org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be
> cast to org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
> > To: "Struts Users Mailing List" ,
> newton.d...@yahoo.com
> > Date: Tuesday, December 16, 2008, 10:26 AM
>  > In
> > http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html
> > , it use
> > MultiPartRequestWrapper multipartRequest =
> > (MultiPartRequestWrapper)
> > ServletActionContext.getRequest();
> > It still raise java.lang.ClassCastException:
> > org.apache.struts2.dispatcher.StrutsRequestWrapper cannot
> > be cast to
> > org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.
> > My popuse is that when jsp sumbit to action,I can get
> > upload file name and
> > the stream of upload file,then I can write the stream of
> > upload file into
> > blob of oracle database.I don't know how to get the
> > stream of upload file!
> >  I still puzzled with why raise above error. I don't
> > find the different
> > between my code and
> > http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html.
> >
> > Where wrong with my code?
> >
> >
> >
> >
> > On Tue, Dec 16, 2008 at 11:13 PM, Dave Newton
> >  wrote:
> >
> > > --- On Tue, 12/16/08, red phoenix wrote:
> > > > [...]
> > > > MultiPartRequestWrapper multipartRequest =
> > > > (MultiPartRequestWrapper)
> > ServletActionContext.getRequest();
> > > > [...]
> > > >
> > > >
> > org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be
> > cast to
> > > >
> > org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
> > > >
> > > > Why raise above error?
> > >
> > > Because StrutsRequestWrappers can't be cast to
> > MultiPartRequestWrappers.
> > >
> > > > How to correct it?
> > >
> > > Use the built-in file upload capabilities of Struts 2;
> > there's no reason to
> > > access the request manually.
> > >
> > > Here's that link again:
> > >
> > >
> > http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html
> > >
> > > Dave
> > >
> > >
> > >
> > -
> > > To unsubscribe, e-mail:
> > user-unsubscr...@struts.apache.org
> > > For additional commands, e-mail:
> > user-h...@struts.apache.org
> > >
> > >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

2008-12-16 Thread red phoenix
In http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html , it use
MultiPartRequestWrapper multipartRequest = (MultiPartRequestWrapper)
ServletActionContext.getRequest();
It still raise java.lang.ClassCastException:
org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.
My popuse is that when jsp sumbit to action,I can get upload file name and
the stream of upload file,then I can write the stream of upload file into
blob of oracle database.I don't know how to get the stream of upload file!
 I still puzzled with why raise above error. I don't find the different
between my code and
http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html.

Where wrong with my code?




On Tue, Dec 16, 2008 at 11:13 PM, Dave Newton  wrote:

> --- On Tue, 12/16/08, red phoenix wrote:
> > [...]
> > MultiPartRequestWrapper multipartRequest =
> > (MultiPartRequestWrapper) ServletActionContext.getRequest();
> > [...]
> >
> > org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
> > org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
> >
> > Why raise above error?
>
> Because StrutsRequestWrappers can't be cast to MultiPartRequestWrappers.
>
> > How to correct it?
>
> Use the built-in file upload capabilities of Struts 2; there's no reason to
> access the request manually.
>
> Here's that link again:
>
> http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html
>
> Dave
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

2008-12-16 Thread red phoenix
I use struts2.0.14,I want to use upload function,my jsp file is follows:


...


struts action is follows:
public String uploadFile() throws Exception{
MultiPartRequestWrapper
multipartRequest=((MultiPartRequestWrapper)ServletActionContext.getRequest());

...
return SUCCESS;
}

when I submit jsp to action,it raise following error:
java.lang.ClassCastException:
org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

Why raise above error? How to correct it?

Any idea will be appreciated!


Unexpected Exception caught setting 'uploadFileContentType'

2008-12-14 Thread red phoenix
I want to upload a file in struts2,my jsp file is follows:


 
 





my action is follows:
import java.io.File;
private File uploadFile;
public File getUploadFile(){
  return uploadFile;
 }
 public void setUploadFile(File uploadFile){
  this.uploadFile=uploadFile;
 }
public String upload() throws Exception{
request=ServletActionContext.getRequest();
return SUCCESS;
 }

when I run above code,it shows following error:
2008-12-14 23:45:45
com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
Fatal: ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'uploadFileContentType' on 'class demo.TestAction: Error setting
expression 'uploadFileContentType' with value '[Ljava.lang.String;@80a22'

2008-12-14 23:45:45
com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
Fatal: ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'uploadFileFileName' on 'class demo.TestAction: Error setting
expression 'uploadFileFileName' with value '[Ljava.lang.String;@1d159e4

I have no  'uploadFileContentType'  and 'uploadFileFileName'   in my JSP,why
raise 'uploadFileContentType'  and 'uploadFileFileName'  error? How to
correct my above code?

Thanks in advance!


getOutputStream() has already been called for this response

2008-12-10 Thread red phoenix
I use struts2.0.11,I want to show a picture by struts action,like follows:
public String showphoto() throws Exception{
response=ServletActionContext.getResponse();
response.setContentType("image/png");
...
InputStream in = picture.getBinaryStream();
OutputStream out = response.getOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) != -1){
 out.write(buf, 0, len);
}
in.close();
out.close();
response.flushBuffer();
return SUCCESS;
 }

When I run above code,it can run well,and it can show picture in jsp,but I
find it write error information in tomcat6,like follows:
fatal: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been called
for this response
 at org.apache.catalina.connector.Response.getWriter(Response.java:610)
 at
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
 at
javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)
 at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)

Why raise above error in tomcat6? How to correct my code to correct above
error?
Thanks in advance!


how to use pager tag in struts2?

2008-08-19 Thread red phoenix
I want to use Pager Tag Library2.0 in struts2,I set maxPageItems under
struts2.0 action,like follows:

request.setAttribute("maxPageItems","10");
return SUCCESS;

then I use maxPageItems in JSP page,like follows:

..


When I run above code,it raise error:
22: <%@ include file="/pages/common/common.jsp" %>
23: <%@ taglib uri="http://jsptags.com/tags/navigation/pager"; prefix="pg" %>
24:
25:

struts2 question

2008-03-02 Thread red phoenix
I use struts2.0.11, I use Hibernate to get data and put it into attribute in
struts2 action,like follows:
public String show() throws Exception{
  request=ServletActionContext.getRequest();
  List myList=this.getHibernateTemplate().find("from test.MyModel");
  request.setAttribute("myList",myList);
  return SUCCESS;
 }

Hibernate mapping file is follows:

 
  
   
  
  
   
  

Then I want to show myList by using  tag,like follows:


When I run it,it raise following error:
org.apache.jasper.JasperException: tag 'select', field 'list': The requested
list key '%{myList}' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]

I have searched google for several days,but I don't find how to solve it. I
am puzzled with it! I want to know how to correct my  code?
Any idea will be appreciated!
Best regards
Phoenix


struts2 s:if and displaytag question

2008-02-19 Thread red phoenix
I use Struts2 and displaytag, In testList,there is a abc attribute,it
contains data like "english","france",when abc="english",I want to show
En,else show Eu,my code is follows:


  

En
   
   
   Eu
   


when I execute code,I find it only shows english or france,I don't know why
it don't show En or Eu.Where wrong with my code?

Any idea will be appreciated!
Thanks


Warn: No configuration found for the specified action under struts2.0.11

2007-11-20 Thread red phoenix
I have some configure,and it runs well under struts2.0.9,but it raise
warning under struts2.0.11,my files are follows:

/*struts.xml*/

http://struts.apache.org/dtds/struts-2.0.dtd";>

  
  


/*test.xml*/

http://struts.apache.org/dtds/struts-2.0.dtd";>

  

 /t1.jsp
 /t2.jsp
   
  


/*Struts.properties*/
struts.i18n.reload=true
struts.devMode=true
struts.configuration.xml.reload=true
struts.action.extension=pl

Warn: No configuration found for the specified action: 'testing.pl' in
namespace:
'/test'. Form action defaulting to 'action' attribute's literal value.

I am puzzled with it for several days! Anyone could tell me how to
correct above code to get rid of warning?
Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Error: ParametersInterceptor - [setParameters]

2007-09-26 Thread red phoenix
I use struts2.0.9 and displaytag,xwork-2.0.4.jar,when I click next page of
displaytag,it will raise flowing warning:

Warn: ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'd-1332698-p' on 'class Test.TestAction: Error setting expression
'd-1332698-p' with value '[Ljava.lang.String;@14bf534'

Why raise above waring? How to solve it?
Thanks!


Warn: Parameters: Invalid chunk ignored

2007-09-23 Thread red phoenix
I use Tomcat6.0.14 and struts2,I have a jsp page,and there is a button in
it,when I click this button,it will call Javascript,and redirect another
page,my code is follows:
...
functioin test(){
  document.forms[0].action="a.do";
  document.forms[0].submit();
}
...

 
 Test

   

...

When I run above page,it can redirect the page successly,but Tomcat6 say "
org.apache.tomcat.util.http.Parameters processParameters  Warn: Parameters:
Invalid chunk ignored.",why raise above warning information,why to correct
my code to get rid of this warning?


How to get directory information in struts2 action?

2007-08-19 Thread red phoenix
I want to know how to get directory information in struts2 action,when I run
following action:
http://localhost:8080/struts2-blank-2.0.9/example/HelloWorld.action

I want to get the path value http://localhost:8080/struts2-blank-2.0.9 in
HelloWorld.action,such as:
   public String execute() throws Exception {
String path=//get path value
return SUCCESS;
}

how to do it?


Re: How to make initialize with struts2 action?

2007-08-15 Thread red phoenix
static
{
 //doSomeInit,this only run once
}

above code can't run in struct2 action,it will say "can't use in non-static
class"

I use Struts2+spring2.1+hibernate3.2,I am puzzled with it for many many
days! I am looking for an example,but I don't find it,would you give me an
example project which can run under tomcat6?


On 8/16/07, Nils-Helge Garli <[EMAIL PROTECTED]> wrote:
>
> So you're using Spring? In that case, maybe parts of this tutorial can
> help: http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html
>
> And here's the documentation for the Spring-plugin:
> http://struts.apache.org/2.x/docs/spring-plugin.html
>
> Nils-H
>
> On 8/16/07, red phoenix <[EMAIL PROTECTED]> wrote:
> > I know your meaning,but the question I want to Initialize in struts
> > action,not in common class,because I want to get WebApplicationContext
> in
> > struts action,and then I will transfer WebApplicationContext into dao to
> get
> > data. I don't know if there is a init method in struts2 action?
> > Any idea will be appreciated!
> >
> >
> > On 8/16/07, Leonidas Papadakis <[EMAIL PROTECTED]> wrote:
> > >
> > > I think you can use the setters after you initialize your class
> > > i.e.instead of
> > > MyType mt = new MyType(...parameters...);
> > > to do :
> > > MyType mt = new MyType();
> > > mt.setParam1()
> > > e.t.c. I am not exactly sure if this is what you are after though
> > > Why do you want to do this ?
> > >
> > > Leon
> > >
> > > red phoenix wrote:
> > > > If I use no-argument constructor,how can i do to initialize some
> > > > information?
> > > > Thanks
> > > >
> > > >
> > > > On 8/16/07, Rec Floyd <[EMAIL PROTECTED]> wrote:
> > > >
> > > >> Hey,red.In my opinion, to use struts, you have to supply a
> no-argument
> > > >> constructor.That is the point.
> > > >>
> > > >>
> -
> > > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: How to make initialize with struts2 action?

2007-08-15 Thread red phoenix
I know your meaning,but the question I want to Initialize in struts
action,not in common class,because I want to get WebApplicationContext in
struts action,and then I will transfer WebApplicationContext into dao to get
data. I don't know if there is a init method in struts2 action?
Any idea will be appreciated!


On 8/16/07, Leonidas Papadakis <[EMAIL PROTECTED]> wrote:
>
> I think you can use the setters after you initialize your class
> i.e.instead of
> MyType mt = new MyType(...parameters...);
> to do :
> MyType mt = new MyType();
> mt.setParam1()
> e.t.c. I am not exactly sure if this is what you are after though
> Why do you want to do this ?
>
> Leon
>
> red phoenix wrote:
> > If I use no-argument constructor,how can i do to initialize some
> > information?
> > Thanks
> >
> >
> > On 8/16/07, Rec Floyd <[EMAIL PROTECTED]> wrote:
> >
> >> Hey,red.In my opinion, to use struts, you have to supply a no-argument
> >> constructor.That is the point.
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> >
>


Re: How to make initialize with struts2 action?

2007-08-15 Thread red phoenix
If I use no-argument constructor,how can i do to initialize some
information?
Thanks


On 8/16/07, Rec Floyd <[EMAIL PROTECTED]> wrote:
>
> Hey,red.In my opinion, to use struts, you have to supply a no-argument
> constructor.That is the point.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


How to make initialize with struts2 action?

2007-08-15 Thread red phoenix
For general Java class,we can make construction function,like this:
public class test{
  String a;
  public test(String a){
 this.a=a;
  }
}

I don't know if I can do it like above code under struts2 action,for some
reason,I want to initialize some variable and assign some value to it,like
follows:
public class MyClass extends ActionSupport{
private ;
public MyClass(SomeType s){
   //make some common operaction,such get session and so on,because I
want to run them only once
}
public String execute() throws Exception {
  
}
public String .{
}
   ...
}

I can successly compile above code,but when I run above code,it will say
error:
1)MyClass action error
2)java.lang.NullException because some code in MyClass(SomeType s)

When I remove the code in the MyClass(SomeType s) into execute() function,it
can run well.  I am puzzle with it! Anybody could tell me how to do it?  An
example is better.

Thanks,
phoenix


Re: how to include struts by using

2007-07-11 Thread red phoenix

I tried with ,it still raise a question,I use Tomcat6,my directory
is follows:
C:\tomcat\webapps\struts2-blank-2.0.8

when I use visit
http://localhost:8080/struts2-blank-2.0.8/a.jsp <http://lo>
it raise following error:
The requested resource (/struts2-blank-2.0.8/example/HelloWorld.action) is
not available

But when I use
http://localhost:8080/struts2-blank-2.0.8/example/HelloWorld.action, it can
runs well.

My a.jsp file is follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>




If I use absolute path,it can runs well,like follows:
http://localhost:8080/struts2-blank-2.0.8/example/HelloWorld.action"/>

I only want to use relative path,not absolute path,I don't know why raise
above error,and how to correct it ?

Thanks



On 7/12/07, Michael Jouravlev <[EMAIL PROTECTED]> wrote:


On 7/11/07, red phoenix <[EMAIL PROTECTED]> wrote:
> I want to use 
>   
>
>
> but when I run this jsp file,http://localhost:8080/a.jsp,it raise
> error,it shows it can't find a1.do and a2.do,but when I write follows in
IE,
> http://localhost:8080/a1.do, it can show right result.
>
> I am puzzled with it.I wan to know if I don't use 
> How to include struts in JSP?

I just checked with Tomcat 6 and it worked for me. Seems that your
Struts app is a root app for your servlet container, I just checked
it. Can't help you more, sorry.

Important: after you sort out the pathing/context issue, replace
 with , otherwise you may have problems
including Struts-generated content -- usually a JSP page -- into
another JSP page.

Michael.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




how to include struts by using

2007-07-11 Thread red phoenix

I want to use 
 


but when I run this jsp file,http://localhost:8080/a.jsp,it raise
error,it shows it can't find a1.do and a2.do,but when I write follows in IE,
http://localhost:8080/a1.do, it can show right result.

I am puzzled with it.I wan to know if I don't use 

How to set attribute of

2007-05-12 Thread red phoenix

I read document from struts2 and I know  has
label,name,cssStyle,cssClass,so I use  as follows:

I want  to set label "Your First Name" as red color and font size is 6,but
when I execute above code,I found label "Your First Name" is still black
color and not red color and its size is not 6,why? How to define label
attribute in  to realize above function?

My other question is when execute ,it will shows follows:

Your First Name:|Mary|

I want to know how to set its length,such as label "Your First Name" occupy
30% width of line and "Mary" occupy 70% width of line?

Thanks


Re: Struts2 character code question

2007-05-08 Thread red phoenix

I have set URIEncoding="UTF-8"
and when I submit as


and I get String name=request.getParameter("Name")
it get name as UTF-8 format,so I can't get right chinese code

I tried set 

This time,I can get right chinese code in test.do by
String name=request.getParameter("Name")

But i only want to set 

Anybody could tell me how to do in test.do file?



On 5/9/07, Martin Gainty <[EMAIL PROTECTED]> wrote:


apparently ISO2022_CN_GB is Mandarin
(http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html)
since this is most decidedly DBCS did you load CJK IME /Keyboard and
Fonts?

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please
notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message -
From: "red phoenix" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Tuesday, May 08, 2007 8:47 PM
Subject: Re: Struts2 character code question


>I tried follows in test.do:
> String name=request.getParameter("Name");
> System.out.println(new String(name.getBytes("UTF-8"), "gb2312"))
> it still show [EMAIL PROTECTED],Why?
>
>
>
> On 5/8/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:
>>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Red,
>>
>> red phoenix wrote:
>> > If I input English name in the field Name in JSP,when I submit,the
>> > test.do will receive right English name,but when I input Chinese name
>> > in the field Name in JSP, test.do will receive not right name,it will
>> > show [EMAIL PROTECTED]
>>
>> This is what you get when you print out a byte array. Try converting
the
>> byte array to a String using "new String(bytes, charset)" and printing
>> that.
>>
>> - -chris
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.7 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFGQJwZ9CaO5/Lv0PARAmyvAJ9aCJZ/MINdBzS18ytQMgzf4M8D3ACffHSG
>> Ldprq3v5ZTLxYF80HoafTOY=
>> =vx7I
>> -END PGP SIGNATURE-
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Struts2 character code question

2007-05-08 Thread red phoenix

I tried follows in test.do:
String name=request.getParameter("Name");
System.out.println(new String(name.getBytes("UTF-8"), "gb2312"))
it still show [EMAIL PROTECTED],Why?



On 5/8/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Red,

red phoenix wrote:
> If I input English name in the field Name in JSP,when I submit,the
> test.do will receive right English name,but when I input Chinese name
> in the field Name in JSP, test.do will receive not right name,it will
> show [EMAIL PROTECTED]

This is what you get when you print out a byte array. Try converting the
byte array to a String using "new String(bytes, charset)" and printing
that.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGQJwZ9CaO5/Lv0PARAmyvAJ9aCJZ/MINdBzS18ytQMgzf4M8D3ACffHSG
Ldprq3v5ZTLxYF80HoafTOY=
=vx7I
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Struts2 character code question

2007-05-08 Thread red phoenix

I have set my all files with UTF-8 format,so I set URIEncoding parameter in
server.xml in tomcat6.0.10,like follows:

Then I write a JSP file like follows:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>





In test.do action,I get the value of Name from JSP,like follows:
request.getParameter("Name");
System.out.println("Name="+Name);
If I input english name in the field Name in JSP,when I submit,the
test.dowill receive right english name,but when I input chinese name
in the field
Name in JSP,test.do will receive not right name,it will show [EMAIL PROTECTED]
I know it must be wrong in character change.But I don't want to change
URIEncoding from UTF-8 to GB2312 in the server.xml file,I guess I should do
something in test.do,but I don't know how to do it.
Anybody could tell me how to do it? Would you give me some code?

Thanks


Ajax can't receive Chinese code from action of struts2

2007-04-28 Thread red phoenix

when ajax receive information which include Chinese code from action of
Struts2,ajax will show chinese code into confusion code,but if ajax receive
information which include Chinese code from jsp, ajax will show correct
Chinese code.I don't know why raise this error!  How to correct it?

My code is follows:
/*a.html  saved as UTF-8 code*/


var xmlhttp;
function CreateXmlRequest(){
   try {
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch(e){
   try{
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (e){
   try{
   xmlhttp = new XMLHttpRequest();
   }
   catch (e){
   xmlhttp = false;
   }
}
   }
}

function checkUserName(){
   xmlhttp.open("get", "example/test.action", true);
   xmlhttp.onreadystatechange = updatePage;
xmlhttp.send(null);
}

function updatePage(){
   try{
   if(xmlhttp.readyState == 4){
alert(xmlhttp.responseText);
   }
   }
   catch (e){}
}
CreateXmlRequest();






/*HelloWorld.java  saved as UTF-8 no BOM code,I compile as C:>javac -d .
HelloWorld.java  */
package example;
import org.apache.struts2.ServletActionContext;
import java.io.*;
import javax.servlet.http.HttpServletResponse;
public class HelloWorld extends ExampleSupport {
   public String test() throws Exception {
   HttpServletResponse response;
   response=ServletActionContext.getResponse();
   response.setContentType("text/html;charset=gb2312");
   response.setHeader("Cache-Control", "no-cache");
   response.setHeader("Pargma","no-cache");
   response.setDateHeader("Expires",0);
   StringBuffer sb=new StringBuffer("");
   sb.append
("北京yangzhousuzhou");
   sb.append("");
   PrintWriter out=response.getWriter();
   out.write(sb.toString());
   out.close();
   return null;
   }
}

/*struts.xml*/

http://struts.apache.org/dtds/struts-2.0.dtd";>

   
   
   

/*example.xml*/

http://struts.apache.org/dtds/struts-2.0.dtd";>

   
   
   /example/a.jsp
   
   


When I run a.html,ajax should alert information
"北京yangzhousuzhou",but
it shows "?confusion
characters?yangzhousuzhou"

Anybody know how to do it?
Thanks!


How to realize ajax in struts2

2007-04-23 Thread red phoenix

I want to use ajax within Struts to realize following function,there is a
textfield an a submit button which use register a username in a JSP
page,then you can put you name into textfield and click register button,then
will call ajax to search name is exist,if exist,there will be a message
behind textfield,say "name is exist,please use another name",like follows:
---
Name:| |
---
Register button

My code is follows,but my code can't reach my goal,I don't know how to
realize it?  Anybody could tell me how to do it? Thanks!

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>



 



Name:







Could not load 'dojo.widget.html.Tooltip':last tried '__package__.js'

2007-04-23 Thread red phoenix

I want to use ajax in struts2,but when run my code like
http://localhost:8080/test/index.html,it raise following Javascript error:
Line:95
Char:1
Error:Could not load 'dojo.widget.html.Tooltip':last tried '__package__.js'
Code:0
URL:http://localhost:8080/test/test/Test.action

My code is follows:
/*index.html*/



   


Loading ...



/*Test.jsp*/
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


   Ajax Examples
   
   
   function doSomething() {
   alert('you can manipulate the form before it gets submitted');
   return true;
   }
   


Remote form replacing another div:
initial content

   
   




/*Test.java*/
package test;
import java.io.*;
import com.opensymphony.xwork2.*;
public class Test extends ActionSupport implements Action, Serializable{
   private static int counter = 0;
   private String data;
   public long getServerTime() {
   return System.currentTimeMillis();
   }
   public int getCount() {
   return ++counter;
   }
   public String getData() {
   return data;
   }
   public void setData(String data) {
   this.data = data;
   }
   public String execute() throws Exception {
   return SUCCESS;
   }
}

/*struts.xml*/

http://struts.apache.org/dtds/struts-2.0.dtd";>

   
   
   
   


/*test.xml*/
?xml version="1.0" encoding="UTF-8" ?>
http://struts.apache.org/dtds/struts-2.0.dtd";>

   

   
   /test/Test.jsp
   
   
   


I don't know where wrong in my code? I want to know if I lost some js or jar
file? How to correct my code? My code structure is follows:
D:\tomcat6\webapps\test\index.html
D:\tomcat6\webapps\test\test\Test.jsp
D:\tomcat6\webapps\test\WEB-INF\web.xml
D:\tomcat6\webapps\test\WEB-INF\classes\struts.xml
D:\tomcat6\webapps\test\WEB-INF\classes\test.xml
D:\tomcat6\webapps\test\WEB-INF\classes\test\Test.class
D:\tomcat6\webapps\test\WEB-INF\lib\commons-logging-1.1.jar
D:\tomcat6\webapps\test\WEB-INF\lib\freemarker-2.3.8.jar
D:\tomcat6\webapps\test\WEB-INF\lib\ognl-2.6.11.jar
D:\tomcat6\webapps\test\WEB-INF\lib\struts2-core-2.0.6.jar
D:\tomcat6\webapps\test\WEB-INF\lib\xwork-2.0.1.jar

Thanks


Re: How to set filter in Struts2?

2007-04-19 Thread red phoenix

Would you give me a simple code for it?

On 4/20/07, Drew Kutcharian <[EMAIL PROTECTED]> wrote:


Can you use different filters/filter mappings for different URL patterns?

Drew Kutcharian
Venarc Inc.   www.venarc.com



- Original Message 
From: red phoenix <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Thursday, April 19, 2007 7:58:47 PM
Subject: How to set filter in Struts2?

I want to set a filter,then I set different character code by this
filter,such when a request from a1.action,I will set this character code
is
UTF-8,a request from a2.action,I will set this character code is
ISO88591,and so on.I don't know how to realize above function in filter?
Anybody could tell me how to do it?

Thanks.







How to set filter in Struts2?

2007-04-19 Thread red phoenix

I want to set a filter,then I set different character code by this
filter,such when a request from a1.action,I will set this character code is
UTF-8,a request from a2.action,I will set this character code is
ISO88591,and so on.I don't know how to realize above function in filter?
Anybody could tell me how to do it?

Thanks.


why Struts2 can't receive Jsp variable value by using Ajax1.2?

2007-02-09 Thread red phoenix

I have a text area and a text link in a jsp page,when I click this text
link,I will call struts2 action by using ajax,like follows:
/*-jsp page-*/


var http = getHttpObject();
function getHttpObject(){
var xmlhttp = false;
if(window.XMLHttpRequest){
 xmlhttp = new XMLHttpRequest();
 if(xmlhttp.overrideMimeType){
  xmlhttp.overrideMimeType('text/xml');
  }
}
else{
 try{
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch(e){
  try{
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  catch(e){
   xmlhttp = false;
  }
 }
}
return xmlhttp;
}
function handleHttpResponse(){
if(http.readyState == READY_STATE_COMPLETE){
 if(http.status == 200){
  var text = http.responseText;
  if(text != null || text.length >0)
 alert(text);
 }
 else{
  alert("error!!!");
  alert(http.status);
 }
}
}
function test(){
var t1=document.forms[0].abc.value;
alert(t1);
var url = "add.action";
http.open("POST",url,false);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}




  
  
  tt




/*struts2 action*/
public class TestAction extends ActionSupport{
String abc;
public String add() throws Exception {
 System.out.println("abc="+abc);
 return null;
}
public String getAbc(){
 return abc;
}
public void setAbc(String abc){
 this.abc=abc;
}
}

I put some text in textfield and then I click tt link,it call struts2
action,it execute System.out.println("abc="+abc),it should show the text
value,but it shows null value!!!
abc=null

If I don't use ajax,and only use document.forms[0].submit(),struts2 can show
right value,like follows:
abc=the text you put

I am puzzled with it! Why struts2 can't get jsp page value by using ajax?
Anybody could tell me how to correct my above code?

Thanks in advance!


How to use

2007-01-24 Thread red phoenix

I want to use ,I read
treeExampleDynamic.jsp of struts2 document,like follows:

function treeNodeSelected(nodeId) {
dojo.io.bind({
   url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action'
/>?nodeId="+nodeId,
   load: function(type, data, evt) {
   var displayDiv = dojo.byId("displayId");
   displayDiv.innerHTML = data;
 },
mimeType: "text/html"
});
};

dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");






I don't know what meaning of  dojo? I don't use the object dojo before! And
I don't know how to use it.Anybody can tell how to use it? I want to make a
dynamic tree,and I can add,modify and delete any node of the dynamic
tree,how to realize it? Is there a source code for me?

Thanks in advance!
Best regards,
phoenix


java.io.WriteAbortedException

2006-12-25 Thread red phoenix

When I start tomcat6 and struts2,sometimes when I start tomcat,it will raise
following error,but sometimes when I start tomcat6,it don't raise any error!
I am puzzled with it for a very long time!!! Anyone could tell the reason
and how to solve it?
Error information is following:
Exception loading sessions from persistent storage
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException:
org.apache.catalina.connector.RequestFacade
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java
:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at java.util.ArrayList.readObject(ArrayList.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java
:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java
:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.apache.catalina.session.StandardSession.readObject(
StandardSession.java:1440)
at org.apache.catalina.session.StandardSession.readObjectData(
StandardSession.java:943)
at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java
:394)
at org.apache.catalina.session.StandardManager.load(StandardManager.java
:321)
at org.apache.catalina.session.StandardManager.start(StandardManager.java
:637)
at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java
:432)
at org.apache.catalina.core.StandardContext.start(StandardContext.java
:4257)
at org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java
:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java
:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:451)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.io.NotSerializableException:
org.apache.catalina.connector.RequestFacade
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java
:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at java.util.ArrayList.writeObject(ArrayList.java:570)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.Obj

Re: where to download struts2.0 examples files?

2006-12-19 Thread red phoenix

Struts2 distributes apps only struts2-blank-2.0.1,struts2-mailreader-2.0.1,
struts2-portlet-2.0.1 and struts2-showcase-2.0.1,I can't find
org.apache.struts2.example.* files!

On 12/19/06, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:




Weren't they in Struts2 distribution ...\apps  ?

/S

-Original Message-
From: red phoenix [mailto:[EMAIL PROTECTED]
Sent: 19. joulukuuta 2006 9:49
To: Struts Users Mailing List
Subject: where to download struts2.0 examples files?

In struts doc,I often see "org.apache.struts2.example.*",I want to know
where I can download the example fiels?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




bean method don't make function in Struts2

2006-12-19 Thread red phoenix

I use struts2 ,like follows:

---SimpleCounter---
package test;
public class SimpleCounter{
String foo;

public void setFoo(String foo){
 System.out.println("set foo="+foo);
 this.foo=foo;
}
public String getFoo(){
 System.out.println("get foo="+foo);
 return foo;
}
}

---test.jsp---
<%@ taglib uri="/struts-tags" prefix="s" %>

  
  The value of foot is : , when inside the bean
tag 


When I run it,tomcat shows:
set foo=null
get foo=null

IE shows:
The value of foot is : , when inside the bean tag

I think  should call setFoo("BAR") and
should print set foo=BAR,I don't know why print set foo=null. Anyone can
tell me the reason of error.

Thanks


where to download struts2.0 examples files?

2006-12-18 Thread red phoenix

In struts doc,I often see "org.apache.struts2.example.*",I want to know
where I can download the example fiels?


in struts2

2006-12-18 Thread red phoenix

I want to change my code from struts1 to struts2,I use displaytag and
 to show following code,it can run well, will show 1,2,
<%@ taglib uri="/struts-tags" prefix="s" %>


>


I know struts2 will use  and use  to
replace ,so I modify code like
follows:
<%@ taglib uri="/struts-tags" prefix="s" %>


/>


But when I run it,I find  don't make any
function,checkbox's value is still  and not the
real value "1,2,3"
I am puzzled with struts2,because there is not a learning book about
struts2,the struts2 document is very brief,not detail!
Anybody could give me a detail method to resovle my above question?

Thanks in advance
Best regards,
Rod


in Struts2

2006-12-18 Thread red phoenix

I put a String into a session,and I use  to determine the session if
it is exist,if exist,show OK,if not exist,it shows error,but when I run
it,it shows error,I don't know why don't show OK? How to correct to show OK?
my code is follows:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">


<%
request.setAttribute("tt",new String("1"));
%>


 OK


 Error





in struts2

2006-12-17 Thread red phoenix

I want to realize  in Struts2,when session attribute is
exist,it show "login",if it is not exist,it shows "not login",like follows:

login


not login


I don't know how to use  in struts2,because I don't find
 in struts2,anyone could tell me how to do it and give me
some examples?

Thanks.


struts.i18n.encoding

2006-12-14 Thread red phoenix

I want to set other country language character set,I know I should set
web.xml with struts.i18n.encoding=...
but I don't know the value which  struts.i18n.encoding permited,anyone could
give me a character list of struts.i18n.encoding?

Thanks


struts2.0 action question

2006-12-13 Thread red phoenix

I am puzzled with struts2.0 action file,my files are follows:

configure file is follows

  /chat/read.jsp
  /chat/write.jsp


action file is follows:
public String execute() throws Exception {
  String flag=request.getParameter("flag");
  if("1".equals(flag))
return SUCCESS;
  else if("2".equals(flag))
return READ;
  else
return WRITE;
}

when I compile my action file,it raise error,say READ and WRITE don't
define.I am puzzled with it. Why SUCCESS is define,READ and WRITE don't
define? I don't find anywhere to define SUCCESS! How to do it?
if return SUCCESS,it will go to which page,read.jsp or write.jsp?

Anyone could get rid of my puzzled?

Thanks


struts2 web.xml question

2006-12-13 Thread red phoenix

I have a filter configure question about struts2,i want to filter character
code in web.xml file,I know how to configure it in struts 1.3,
C:\tomcat\webapps\exercise\WEB-INF\web.xml
...

 Set Character Encoding
 filters.SetCharacterEncodingFilter
   
  encoding
  gb2312
   



  Set Character Encoding
  /*


In struts 1.3,it runs well.Now I want to configure it again under struts2.0,I
read struts2.0 web.xml configure,it's content like follows:

 struts2
  org.apache.struts2.dispatcher.FilterDispatcher




 struts2
 /*


Then I add my configure into C:\tomcat\webapps\exercise\WEB-INF\web.xml,like
follows;

 struts2
 org.apache.struts2.dispatcher.FilterDispatcher


 Set Character Encoding
 filters.SetCharacterEncodingFilter
   
encoding
gb2312
   



   struts2
   /*

   Set Character Encoding
   /*


Then I start tomcat,but it raise follows error when tomcat start,the errors
like follows;
info: XML validation disabled
log4j:WARN No appenders could be found for logger (
org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2006-12-13 23:43:31 org.apache.catalina.core.StandardContext start
fatal: Error filterStart
2006-12-13 23:43:31 org.apache.catalina.core.StandardContext start
fatal: Context [/exercise] startup failed due to previous errors

I guess I must make a mistake in web.xml,but I don't know how to correctly
configure it,anyone could tell how to do it?
By the way,when tomcat start,it always say
log4j:WARN No appenders could be found for logger (
org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.

why raise above warn message,how to correct it?

Thanks in advance!


struts2.0 question

2006-12-11 Thread red phoenix

I have a question about Struts 2.0 Action,I find Action will extends
ActionSupport,like follows:
public class GetUpdatedHangmanAction extends ActionSupport implements
SessionAware {
private static final long serialVersionUID = 5506025785406043027L;
.


I am puzzled with variable serialVersionUID,I want to know if this variable
is necessary for Action,if it is necessary,how to calculate the value of
serialVersionUID,why it is equals 5506025785406043027?

Anyone can give me some advice?

Thanks


how to learn Struts 2

2006-12-04 Thread red phoenix

I am a newer of Struts 2,I find my application of Struts1 are can't run
under Struts 2.I want to know Struts 2,but I don't know how to learn
Struts2,would you give me some advice or material to learn?

Thanks


org.apache.commons.validator not exist

2006-11-29 Thread red phoenix

I compile my Java file,but it raise error:org.apache.commons.validator not
found,I guess I must lost a jar file,but I don't know which jar I
lost,anyone could tell me which jar I need?

Thanks.


How to realize print function

2006-11-01 Thread red phoenix

I want to realize print function in Struts,when click a button in jsp
page,it will print part of screen information in Printer. I know javascript:
window.print() can realize print function,but it don't fit me,because
window.print() will print all screen information.I know another method,it
will write information into Excel and then print it in Excel,but it don't
fit me too,because it don't print directly! I want to know how to realize
print function directly?

Thanks in advance


Struts Encode question

2006-10-05 Thread red phoenix

I want to get a value from a JSP in Action,like follows:
/*jsp*/
<%@ page contentType="text/html;charset=gb2312" %>



And I input a Chinese Word in ex area,then I get the ex value from a
Action,like follows:
/*Action*/
public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest request,HttpServletResponse response) throws
Exception {
  request.setCharacterEncoding("gb2312");
  String ex=request.getParameter("ex");


But I find ex don't show propertly,it should show right Chinese word,but it
shows ???í?±,I use DynaActionForm,like follows:

  form-property
  name="ex"
  type="java.lang.String"/>
...

Why struts don't show propertly? How to show Chinese Word in Struts Action?

Thanks.


compile getDataSource error in Action

2006-09-28 Thread red phoenix

I use JDK1.6 and Struts1.3.5,I use Javac to compile a  Action file,like
follows:
javac xxxAction.java
but when I compile it,it raise follows error:

xxxAction.java:31: Can't find symbol
symbol: method getDataSource(javax.servlet.http.HttpServletRequest,
java.lang.String)
location: class xxxAction
   DataSource dataSource=getDataSource(request,"yy");
 ^
1 error

Why raise above error? How to correct it?
Thanks


Struts validation question

2006-07-04 Thread red phoenix

I want to use struts validation,when field is invalidate,my program can
raise information,like follows:
Username is required.
Password is required.
Phone Number is required.

I know it's server-side validation,I want to use client-side validation,so I
put some code in my JSP files:



When I run this JSP and put some invalidation in fields,I find Javascript
don't work at all,it still raise follows:
Username is required.
Password is required.
Phone Number is required.
My JDK is 1.6,tomcat5.5.17 and struts is 1.2.9,I want to know if struts is
1.2.9 change the method of supporting client-side validation?

Any idea will be appreciated!


[Default Bundle] Missing Field

2006-06-29 Thread red phoenix

I use JDK1.6,tomcat5.0.28,Struts1.2.9,I run Bundles Example
Form
of
struts-examples.war,when I click Save button,I find the Field Address
say "[Other
Bundle]Missing Field: Address(Other Bundle) "
Why raise above error?  How to correct it?


Null Exception in ActionForm

2006-05-19 Thread red phoenix

I have two jsp file,such a.jsp and b.jsp,one Action file and one Form file,I
want to from a.jsp to call Action file,and I set value of Form in Action
file,and return to b.jsp,and show value in b.jsp,so I can modify this value
in b.jsp
my struts-config.xml is follows:

  



  



/*b.jsp*/
...




/*TestForm.java*/
Package Test
...
public class TestForm extends ActionForm{
private String name;
private String card;
public String getName(){
 return name;
}
public String getCard(){
 return card;
}
public void setName(String name){
 this.name=name;
}
public void setCard(String card){
 this.card=card;
}
}

/*TestAction.java*/
Package Test;
...
public class TestAction extends Action{
TestForm f=(TestForm)form;
//here query some data from database
//and put the query result in TestForm
//so it will show them in b.jsp and I can change the value in b.jsp
f.setName("John");
f.setCard("1");
return mapping.findForward("cc");
}

First I show a.jsp page,and there is a href in this page,when click this
href and it will point to /test,but it raise error,it say Null exception at
f.setName("John") in TestAction.java,I guess TestForm may be  null.How to
do to realize put some value in Form through Action and put return to
b.jspshow and may modify these value in
b.jsp?

Thanks in advance


Download question

2006-04-05 Thread red phoenix
I want to realize download function in struts,and I will put some file url
in JSP file,when click one of the file url,this file will be
download.Dostruts or some taglib support download function?

Thanks in advance


Is there a struts Taglib document?

2006-04-04 Thread red phoenix
Is there a struts taglib document about ,,,the
chm file form is better. If you have it,please give it to me.

Thanks!


action not work

2006-04-03 Thread red phoenix
I have a submit button in A.jsp,and I want to submit to B.do from A.jsp,but
when I click this submit button,it should submit to B.do and show some
information on screen,but in fact it doesn't work,when I use
http://localhost:8080/B.do, it can work.I don't know why it don't work from
A.jsp to B.do?
My code is follows:
/*A.jsp*/
<%@ taglib uri="/WEB-INF/taglib/struts-html" prefix="html"%>





/*AForm.java*/
package test;
import org.apache.struts.action.ActionForm;
public class AForm extends ActionForm{
}

/*AAction.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;
public class AAction extends Action{
 public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest req,HttpServletResponse res){
  System.out.println("A action");
  return mapping.findForward("B");
 }
}

/*B.jsp*/


Hello world



/*BForm.java*/
package test;
import org.apache.struts.action.ActionForm;
import org.apache.struts.upload.FormFile;
public class BForm extends ActionForm{
   protected FormFile attachFile;
   public FormFile getAttachFile(){
 return attachFile;
  }
  public void setAttachFile(FormFile attachFile){
  this.attachFile=attachFile;
 }

/*BAction.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.upload.FormFile;
public class BAction extends Action{
 public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest req,HttpServletResponse res){
  System.out.println("B action");
  return mapping.findForward("B");
}

/*struts-config.xml*/

http://struts.apache.org/dtds/struts-config_1_2.dtd
">




 

 
  
  
  
  
  
 
  

 


Re: Servlet action is not available

2006-04-03 Thread red phoenix
 Mr Craig,
   I  configure a JNDI in Tomcat5.5.12 like you tell me,like follows:





Then I call this JNDI in a JSP file,the JSP file is follows:

<[EMAIL PROTECTED] <[EMAIL PROTECTED]> <[EMAIL PROTECTED]@page> 
import="java.sql.*"%>
<[EMAIL PROTECTED] <[EMAIL PROTECTED]> import="javax.sql.DataSource"%>
< [EMAIL PROTECTED] <[EMAIL PROTECTED]> import="javax.naming.*"%>


<%
 try{
  Context initCtx=new InitialContext();
  System.out.println("ok");
  DataSource db = (DataSource)initCtx.lookup("java:comp/env/jdbc/bb1");
  System.out.println("db="+db);
  Connection conn = db.getConnection();
  System.out.println("conn="+conn);
  Statement stmt = conn.createStatement();
  ResultSet rs = stmt.executeQuery ("SELECT * FROM abc");
  out.println("User-list"+"");
  while(rs.next()){
   out.print(rs.getString(1)+"");
  }
  rs.close();
  stmt.close();
  conn.close();
 }catch(Exception e){
  out.print(e);
 }
%>





javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Why?
 Any idea will be appreciated!

Best regards,


On 4/4/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
>
> On 4/3/06, red phoenix <[EMAIL PROTECTED]> wrote:
> >
> > My Struts is 1.2.9,and tomcat is 5.5.15,and JDK is 1.5,I want to use
> > Struts
> > Datasource,my database is Microsoft Access 2000,and I have configured
> ODBC
> > datasource in windows,when I run it, it raise follows error:
> > type Status report
> > message Servlet action is not available
> > description The requested resource (Servlet action is not available) is
> > not
> > available.
>
>
> "Servlet action is not available" almost always means that some exception
> was thrown as the Struts action servlet was first initialized.  The
> exception will be logged in one of the Tomcat log files
> ($CATALINA_HOME/logs/*).
>
> In your particular case, the most likely problem is trying to use the
> Struts
> data source.  This functionality was deprecated in Struts 1.1, and was
> removed in Struts 1.2.  You should use the JNDI data sources provided by
> your container (Tomcat) instead.  There is pretty reasonable documentation
> on the Tomcat web site for how to set this stuff up, which applies to all
> webapps, not just Struts based ones.
>
>
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
> Historical note -- the only reason Struts 1.0 supplied a data source
> implementation in the first place was that, six years ago, most servlet
> containers did not support JNDI based resource access.  Now that they
> (essentially) all do support JNDI, that is the recommended mechanism for
> managing data sources.
>
> Craig
>
>


Servlet action is not available

2006-04-03 Thread red phoenix
My Struts is 1.2.9,and tomcat is 5.5.15,and JDK is 1.5,I want to use Struts
Datasource,my database is Microsoft Access 2000,and I have configured ODBC
datasource in windows,when I run it, it raise follows error:
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not
available.

My code is follows:
/*TestForm.java*/

*package* test;*import* org.apache.struts.action.*;*public* *class*
TestForm *extends* ActionForm{}



/*TestAction.java*/

*package* test;*import* java.io.*;*import* java.util.*;*import*
java.sql.*;*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*
javax.servlet.http.HttpServletRequest;*import*
javax.servlet.http.HttpServletResponse;
 *public* *class* TestAction *extends* Action {
 *public* ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
*throws* Exception {
  System.out.println("ok");

  javax.sql.DataSource dataSource;
  java.sql.Connection myConnection=*null*;
  *try*{
   dataSource = getDataSource(request);
  myConnection = dataSource.getConnection();
  Statement stmt = myConnection.createStatement();
  ResultSet rs = stmt.executeQuery("SELECT * FROM abc");

  *while*(rs.next()){
   System.out.print(rs.getString(1));
  }
  rs.close();
  stmt.close();

 }*catch*(Exception e){
  e.printStackTrace();
 }
 *finally*{
  *try* {
myConnection.close();
 }
 *catch* (SQLException e) {
   e.printStackTrace();
 }
 }
  *return* *null*;
   }}



/*Struts-config.xml*/


http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";>















 








/*test.jsp*/



OK





/*web.xml*/


http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

  Struts Blank Application
  
  
action
org.apache.struts.action.ActionServlet

  config
  /WEB-INF/struts-config.xml


  debug
  2


  detail
  2

2
  
  
  
action
*.do
  
  
  
index.jsp
  
  
  
/tags/struts-bean
/WEB-INF/struts-bean.tld
  
  
/tags/struts-html
/WEB-INF/struts-html.tld
  
  
/tags/struts-logic
/WEB-INF/struts-logic.tld
  
  
/tags/struts-nested
/WEB-INF/struts-nested.tld
  
  
/tags/struts-tiles
/WEB-INF/struts-tiles.tld
  




When I run http://localhost:8080/Test.do,it raise following error:
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not
available.

When I removes data-source from Struts-config.xml,it can run well.But when I
add data-source into Struts-config.xml,it raise above erorr. I am puzzled
with it very much! Anybody can tell me the reason and how to correct it?

Thanks in advance!


Re: How to configure Struts connection pool

2006-04-01 Thread red phoenix
when I start Tomcat,it raise following error:
New org.apache.commons.dbcp.BasicDataSource
Begin event threw exception
java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass (
WebappClassLoader.java:1352)
at org.apache.catalina.loader.WebappClassLoader.loadClass(
WebappClassLoader.java:1198)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.struts.digester.ObjectCreateRule.begin(ObjectCreateRule.java
:152)
at org.apache.struts.digester.Digester.startElement (Digester.java:528)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at 
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.struts.digester.Digester.parse(Digester.java:755)
at org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java
:1332)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466)
at javax.servlet.GenericServlet.init(GenericServlet.java :211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java
:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup (
StandardContext.java:3915)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4176)
at org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java
:910)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java
:873)
at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (
LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start (StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java :275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2006-4-2 8:40:02 org.apache.coyote.http11.Http11BaseProtocol start

My use Microsoff Access2000 Database,and I have configure in ODBC,why it
still above raise error?


On 4/2/06, Tarun Reddy <[EMAIL PROTECTED]> wrote:
>
> Hi,
> First of all we need not use "key" attribute in  tag until we
> have more than one data source to be configured. So, try removing the
> "key"
> attribute and use the getDataSource() method which is already defined in
> DBCP.
> DataSource db = getDataSource(request);
> You need not worry about all the naming lookups. That method will take
> care of retrieving DataSource object . Even if you want to keep the "key"
> attribute, then try using this,
> DataSource db= getDataSource(request,key);
>
> This should work for you. Let me know if you still face any issues.
>
> Thanks,
> Tarun.
>
>
> On 4/1/06, red phoenix <[EMAIL PROTECTED]> wrote:
> >
> > I use struts-1.2.9,and want to configure a connection pool,so I
> configure
> > struts-config.xml file
> > 
> > 
> > 
> > 
> > 

Error while configure struts Datasource

2006-04-01 Thread red phoenix
I want to configure data source,I use Tomcat5.5.15 and struts-1.2.9,my
database is Microsoft Access2000,my configure is follows:














.


When I start Tomcat,it raise following error:

New org.apache.commons.dbcp.BasicDataSource
Begin event threw exception
java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(
WebappClassLoader.java:1352)
at org.apache.catalina.loader.WebappClassLoader.loadClass(
WebappClassLoader.java:1198)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.struts.digester.ObjectCreateRule.begin(
ObjectCreateRule.java:152)
at org.apache.struts.digester.Digester.startElement(Digester.java
:528)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch
(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.struts.digester.Digester.parse(Digester.java:755)
at org.apache.struts.action.ActionServlet.initMapping(
ActionServlet.java:1332)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java
:466)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(
StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(
StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(
StandardContext.java:3915)
at org.apache.catalina.core.StandardContext.start(
StandardContext.java:4176)
at org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(
ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java
:524)

at org.apache.catalina.startup.HostConfig.deployDirectory(
HostConfig.java:910)
at org.apache.catalina.startup.HostConfig.deployDirectories(
HostConfig.java:873)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java
:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java
:1118)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1020)

at org.apache.catalina.core.StandardHost.start(StandardHost.java
:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1012)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java
:442)
at org.apache.catalina.core.StandardService.start(
StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java
:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2006-4-2 8:40:02 org.apache.coyote.http11.Http11BaseProtocol start

Why raise above error? How to correct it?

Thanks!


Why struts can't use Tomcat5 connection pool?

2006-04-01 Thread red phoenix
I configure a connection pool in Tomcat5.5.12,like follows:





Then I call this connection pool in a JSP file,the JSP file is follows:

<[EMAIL PROTECTED] <%@<[EMAIL PROTECTED]> import="java.sql.*"%>
<[EMAIL PROTECTED] import="javax.sql.DataSource"%>
<[EMAIL PROTECTED] import="javax.naming.*"%>


<%
 try{
  Context initCtx=new InitialContext();
  System.out.println("ok");
  DataSource db = (DataSource)initCtx.lookup("java:comp/env/jdbc/bb1");
  System.out.println("db="+db);
  Connection conn = db.getConnection();
  System.out.println("conn="+conn);
  Statement stmt = conn.createStatement();
  ResultSet rs = stmt.executeQuery("SELECT * FROM abc");
  out.println("User-list"+"");
  while(rs.next()){
   out.print(rs.getString(1)+"");
  }
  rs.close();
  stmt.close();
  conn.close();
 }catch(Exception e){
  out.print(e);
 }
%>



If I put this JSP file under a ordinary web directory,it runs well. But when
I put this JSP file under Struts,then I call it,it raise follows errors:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

I am puzzled with it!  I don't know why this JSP file can run well under
Tomcat and don't run under Struts? Anybody knows how to solve it? Any idea
will be appreciated!

Best regards,
phoenix


How to configure Struts connection pool

2006-04-01 Thread red phoenix
I use struts-1.2.9,and want to configure a connection pool,so I configure
struts-config.xml file

  
  
  
  
  
  
  
 
 


Then I use this configure in a jsp file,like follows:
<[EMAIL PROTECTED] import="java.sql.*"%>
<[EMAIL PROTECTED] import="javax.sql.DataSource"%>
<[EMAIL PROTECTED] import="javax.naming.*"%>


<%
 try{
  Context initCtx=new InitialContext();
  System.out.println("ok");
  DataSource db = (DataSource)initCtx.lookup("java:comp/env/jdbc/bb1");
  System.out.println("db="+db);
  Connection conn = db.getConnection();
  System.out.println("conn="+conn);
  Statement stmt = conn.createStatement();
  ResultSet rs = stmt.executeQuery("SELECT * FROM abc");
  out.println("User-list"+"");
  while(rs.next()){
   out.print(rs.getString(1)+"");
  }
  rs.close();
  stmt.close();
  conn.close();
 }catch(Exception e){
  out.print(e);
 }
%>



When I run this jsp file,it raise follow errors:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Where error is in my code? Please give me some examples about how to
configure connection pool in Struts and how to call this connection in JSP
file and JavaBean.

Thanks in advance!


Re: migrate question from Struts 1.0.2 to Struts1.2.8

2006-02-28 Thread red phoenix
where error is my code?

On 2/28/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
>
> First things first: did you go through all the migration steps listed on
> the wiki for 1.0 -> 1.2, 1.1 -> 1.2.4, 1.2.4 -> 1.2.7 and 1.2.7 -> 1.2.8?
>
> L.
>
> red phoenix wrote:
> > I have a simple Struts program,it can run well in Struts1.0.2,then I
> migrate
> > it to Struts1.2.8,this time I find index.jsp page shows well,but when I
> > submit this page,it should redirect to show.jsp page and show something
> in
> > it,but in fact it redirect an empty page,it show nothing,even no error
> in
> > Tomcat,I don't know what wrong in my struts program,my code is follows:
> > /* index.jsp */
> > <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
> > 
> >   abc: 
> >  
> > 
> >
> >  /* show.jsp */
> > <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
> > 
> >   result abc: 
> > 
> >
> > /* struts-config.xml */
> > 
> >  >   "-//Apache Software Foundation//DTD Struts Configuration 1.2
> //EN"
> >   "http://struts.apache.org/dtds/struts-config_1_2.dtd";>
> > 
> >   
> > 
> >   
> >   
> >  >type="com.LogmanageAction"
> >name="logmanageForm"
> >validate="true"
> >input="/index.jsp">
> >   
> > 
> >   
> > 
> >
> > /* web.xml */
> > 
> >  >   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
> > 
> >   
> >   
> >action
> > org.apache.struts.action.ActionServlet
> 
> >  
> >   config
> >   /WEB-INF/struts-config.xml
> > 
> > 
> >   debug
> >   2
> > 
> > 
> >   detail
> >   2
> > 
> > 
> >   validate
> >   true
> > 
> > 2
> >   
> >  
> > 
> > action
> > *.do
> >   
> > 
> >   
> > /WEB-INF/struts-bean.tld
> > /WEB-INF/struts-bean.tld
> >   
> >   
> > /WEB-INF/struts-html.tld
> > /WEB-INF/struts-html.tld
> >   
> >   
> > /WEB-INF/struts-logic.tld
> > /WEB-INF/struts-logic.tld
> >   
> > 
> >
> > /* LogmanageForm.java */
> > package com;
> > import org.apache.struts.action.*;
> > import javax.servlet.http.HttpServletRequest;
> > import java.io.*;
> > public class LogmanageForm extends ActionForm{
> >  protected String logstime;
> >  public String getLogstime(){
> >   return loglevel;
> >  }
> >  public void setLogstime(String logstime){
> >   this.logstime=logstime;
> >  }
> > }
> >
> > /* LogmanageAction.java*/
> > package com;
> > import org.apache.struts.action.*;
> > import javax.servlet.http.*;
> > import java.io.*;
> > import java.util.*;
> > import java.sql.*;
> > public class LogmanageAction extends Action{
> >  public ActionForward perform(ActionMapping mapping,ActionForm
> > form,HttpServletRequest req,HttpServletResponse res){
> >  return mapping.findForward("show");
> >  }
> > }
> >
> >
> > Where wrong in my code?
> > Thanks in advance.
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


migrate question from Struts 1.0.2 to Struts1.2.8

2006-02-27 Thread red phoenix
I have a simple Struts program,it can run well in Struts1.0.2,then I migrate
it to Struts1.2.8,this time I find index.jsp page shows well,but when I
submit this page,it should redirect to show.jsp page and show something in
it,but in fact it redirect an empty page,it show nothing,even no error in
Tomcat,I don't know what wrong in my struts program,my code is follows:
/* index.jsp */
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>

  abc: 
 


 /* show.jsp */
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>

  result abc: 


/* struts-config.xml */

http://struts.apache.org/dtds/struts-config_1_2.dtd";>

  

  
  

  

  


/* web.xml */

http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

  
  
   action
org.apache.struts.action.ActionServlet
 
  config
  /WEB-INF/struts-config.xml


  debug
  2


  detail
  2


  validate
  true

2
  
 

action
*.do
  

  
/WEB-INF/struts-bean.tld
/WEB-INF/struts-bean.tld
  
  
/WEB-INF/struts-html.tld
/WEB-INF/struts-html.tld
  
  
/WEB-INF/struts-logic.tld
/WEB-INF/struts-logic.tld
  


/* LogmanageForm.java */
package com;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
public class LogmanageForm extends ActionForm{
 protected String logstime;
 public String getLogstime(){
  return loglevel;
 }
 public void setLogstime(String logstime){
  this.logstime=logstime;
 }
}

/* LogmanageAction.java*/
package com;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class LogmanageAction extends Action{
 public ActionForward perform(ActionMapping mapping,ActionForm
form,HttpServletRequest req,HttpServletResponse res){
 return mapping.findForward("show");
 }
}


Where wrong in my code?
Thanks in advance.


Re: Cannot find ActionMappings or ActionFormBeans collection

2006-02-27 Thread red phoenix
I have solve this problem,because I missing some jars files in lib
directory.
Thanks.


On 2/27/06, Denis Ling <[EMAIL PROTECTED]> wrote:
>
> 
> action
>   org.apache.struts.action.ActionServlet
> 
> application
> resources.application
>   
>   
> config
> /WEB-INF/struts-config.xml
>   
>   
> debug
> 2
>   
>   
> detail
> 2
>   
>   
> validate
>  true
>   
>   2
> 
>
>
>   Can you remove the paragraph that remarked red fonts above and use
>  try again?
>
>
> 2006/2/27, red phoenix <[EMAIL PROTECTED]>:
> >
> > I use 
> > But it still raise same error.
> >
> >
> > On 2/27/06, Denis Ling <[EMAIL PROTECTED]> wrote:
> > >
> > > 
> > > 
> > > ...
> > > 
> > > 
> > >
> > > You should remove the  suffix of "log.do ". In other words you can use
> > > "log"
> > > instead of  "log.do" .
> > >
> > > good luck for you!
> > >
> > >
> > > 2006/2/27, red phoenix < [EMAIL PROTECTED]>:
> > > >
> > > > I use Struts struts-1.2.8,when I execute my JSP file,it raise
> > following
> > > > error:
> > > >
> > > > javax.servlet.ServletException: Cannot find ActionMappings or
> > > > ActionFormBeans collection
> > > > org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
> > > > PageContextImpl.java:858)
> > > > org.apache.jasper.runtime.PageContextImpl.handlePageException (
> > > > PageContextImpl.java:791)
> > > > org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:97)
> > > > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > > > javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
> > > > org.apache.jasper.servlet.JspServletWrapper.service(
> > > JspServletWrapper.java
> > > > :332)
> > > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
> :314)
> >
> > > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > > >
> > > > My index.jsp file is:
> > > >
> > > > <%@ taglib uri=" http://struts.apache.org/tags-html"; prefix="html"
> %>
> > > > 
> > > > 
> > > > ...
> > > > 
> > > > 
> > > >
> > > > struts.config file is:
> > > > 
> > > >  > > >   "-//Apache Software Foundation//DTD Struts Configuration
> 1.0
> > > > //EN"
> > > >   "
> http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd
> > ">
> > > > 
> > > >   
> > > > 
> > > >   
> > > >   
> > > >  > > >type="com.LogmanageAction"
> > > >name="logmanageForm"
> > > >validate="true"
> > > >input="/index.jsp">
> > > >   
> > > > 
> > > >   
> > > > 
> > > >
> > > > web.xml
> > > > 
> > > >  > > >   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> > > >   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
> > > > 
> > > >   
> > > >   
> > > >action
> > > > org.apache.struts.action.ActionServlet
> > > 
> > > >   
> > > >   application
> > > >   resources.application
> > > > 
> > > > 
> > > >   config
> > > >   /WEB-INF/struts-config.xml
> > > > 
> > > > 
> > > >   debug
> > > >   2
> > > > 
> > > > 
> > > >   detail
> > > >   2
> > > > 
> > > > 
> > > >   validate
> > > >   true
> > > > 
> > > > 2
> > > >   
> > > >
> > > >   
> > > > 
> > > > action
> > > > *.do
> > > >   
> > > >   
> > > >   
> > > > /WEB-INF/struts-bean.tld
> > > > /WEB-INF/struts-bean.tld
> > > >   
> > > >   
> > > > /WEB-INF/struts-html.tld
> > > > /WEB-INF/struts-html.tld
> > > >   
> > > >   
> > > > /WEB-INF/struts-logic.tld
> > > > /WEB-INF/struts-logic.tld
> > > >   
> > > > 
> > > >
> > > > My directory is:
> > > > C:\tomcat5\webapps\Log\index.jsp
> > > > C:\tomcat5\webapps\Log\show.jsp
> > > > C:\tomcat5\webapps\Log\WEB-INF\validation.xml
> > > > ..
> > > > C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageAction
> > > > C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageForm
> > > >
> > > > Where raise error?
> > > >
> > > > Thanks in advance!
> > > >
> > > >
> > >
> > >
> > > --
> > > Thanks & Regards
> > > Denis Ling
> > >
> > >
> >
> >
>
>
> --
> Thanks & Regards
> Denis Ling
>
>


Cannot find message resources under key org.apache.struts.action.MESSAGE

2006-02-27 Thread red phoenix
I have configure my properties file,but when run,it raise error and say
can't find message key,my files are follows:
/*index.jsp*/
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>

..



/*application.properties*/
error.header=
error.footer=
error.stime.required=This is a test

/*LogmanageForm.java*/
..
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
..
errors.add("logstime",new ActionError("error.stime.required"));
return errors;
}

/*web.xml*/

http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

  
  
   action
org.apache.struts.action.ActionServlet
  
  application
  resources.application

..


/*struts-config.xml*/

http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

  

  
  

  

  


application.properties is locate follow directory:
C:\tomcat5\webapps\Log\WEB-INF\classes\resources\application.properties

When the JSP execute ,it raise following
error:
javax.servlet.ServletException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(
PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java
:1062)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(
RequestProcessor.java:1000)
org.apache.struts.action.RequestProcessor.processValidate(
RequestProcessor.java:965)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
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)

I have configure the application.properties,why raise above error?
Thanks in advance!

Best Regards,
phoenix


Re: Cannot find ActionMappings or ActionFormBeans collection

2006-02-27 Thread red phoenix
I use 
But it still raise same error.


On 2/27/06, Denis Ling <[EMAIL PROTECTED]> wrote:
>
> 
> 
> ...
> 
> 
>
> You should remove the  suffix of "log.do". In other words you can use
> "log"
> instead of  "log.do" .
>
> good luck for you!
>
>
> 2006/2/27, red phoenix <[EMAIL PROTECTED]>:
> >
> > I use Struts struts-1.2.8,when I execute my JSP file,it raise following
> > error:
> >
> > javax.servlet.ServletException: Cannot find ActionMappings or
> > ActionFormBeans collection
> > org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
> > PageContextImpl.java:858)
> > org.apache.jasper.runtime.PageContextImpl.handlePageException(
> > PageContextImpl.java:791)
> > org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:97)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > org.apache.jasper.servlet.JspServletWrapper.service(
> JspServletWrapper.java
> > :332)
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >
> > My index.jsp file is:
> >
> > <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
> > 
> > 
> > ...
> > 
> > 
> >
> > struts.config file is:
> > 
> >  >   "-//Apache Software Foundation//DTD Struts Configuration 1.0
> > //EN"
> >   "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>
> > 
> >   
> > 
> >   
> >   
> >  >type="com.LogmanageAction"
> >name="logmanageForm"
> >validate="true"
> >input="/index.jsp">
> >   
> > 
> >   
> > 
> >
> > web.xml
> > 
> >  >   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
> > 
> >   
> >   
> >action
> > org.apache.struts.action.ActionServlet
> 
> >   
> >   application
> >   resources.application
> > 
> > 
> >   config
> >   /WEB-INF/struts-config.xml
> > 
> > 
> >   debug
> >   2
> > 
> > 
> >   detail
> >   2
> > 
> > 
> >   validate
> >   true
> > 
> > 2
> >   
> >
> >   
> > 
> > action
> > *.do
> >   
> >   
> >   
> > /WEB-INF/struts-bean.tld
> > /WEB-INF/struts-bean.tld
> >   
> >   
> > /WEB-INF/struts-html.tld
> > /WEB-INF/struts-html.tld
> >   
> >   
> > /WEB-INF/struts-logic.tld
> > /WEB-INF/struts-logic.tld
> >   
> > 
> >
> > My directory is:
> > C:\tomcat5\webapps\Log\index.jsp
> > C:\tomcat5\webapps\Log\show.jsp
> > C:\tomcat5\webapps\Log\WEB-INF\validation.xml
> > ..
> > C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageAction
> > C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageForm
> >
> > Where raise error?
> >
> > Thanks in advance!
> >
> >
>
>
> --
> Thanks & Regards
> Denis Ling
>
>


Cannot find ActionMappings or ActionFormBeans collection

2006-02-26 Thread red phoenix
I use Struts struts-1.2.8,when I execute my JSP file,it raise following
error:

javax.servlet.ServletException: Cannot find ActionMappings or
ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(
PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

My index.jsp file is:

<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>

 
 ...



struts.config file is:

http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

  

  
  

  

  


web.xml

http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

  
  
   action
org.apache.struts.action.ActionServlet
  
  application
  resources.application


  config
  /WEB-INF/struts-config.xml


  debug
  2


  detail
  2


  validate
  true

2
  

  
 
action
*.do
  
  
  
/WEB-INF/struts-bean.tld
/WEB-INF/struts-bean.tld
  
  
/WEB-INF/struts-html.tld
/WEB-INF/struts-html.tld
  
  
/WEB-INF/struts-logic.tld
/WEB-INF/struts-logic.tld
  


My directory is:
C:\tomcat5\webapps\Log\index.jsp
C:\tomcat5\webapps\Log\show.jsp
C:\tomcat5\webapps\Log\WEB-INF\validation.xml
..
C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageAction
C:\tomcat5\webapps\Log\WEB-INF\classes\com\LogmanageForm

Where raise error?

Thanks in advance!


Re: question

2006-02-23 Thread red phoenix
 application.properties file:

errors.footer=
errors.header=
errors.abc.required=This is a test

when I use ,I get following error:
org.apache.jasper.JasperException: /index.jsp(10,20) Attribute header
invalid for tag errors according to TLD
org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





On 2/24/06, Niall Pemberton <[EMAIL PROTECTED]> wrote:
>
> Try having the following in your message resources:
>
> errors.footer=
> errors.header=
>
> ... or rather than using the default, you could specify empty
> header/footer
> labels. In your application resources:
>
> empty.footer=
> empty.header=
>
> ... then on the errors tag:
>
> 
>
> ...or you could use the messages tag instead:
>
>  name="msg"/>
>
> See:
> http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html
>
> Niall
>
> - Original Message -
> From: "red phoenix" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" 
> Sent: Friday, February 24, 2006 2:30 AM
> Subject: Re:  question
>
>
> Thanks Niall, works well. But I find
> another question,first look at my application.properties file:
> errors.footer= 
> errors.header= 
> errors.abc.required=This is a test
>
> In my jsp,use follows statement
> 
>
> If errors is not empty,it will should the error message "This is a test"
> My question is when I run it,it can show the error message "This is a
> test",but the message is not showing in the line with the same line of
>  property="abc" />,I guess the reason is  shows
> not
> only errors.abc,but shows errors.header and errors.footer,so the
>  property="abc" /> and  will not show in the same
> line,if I delete errors.footer and errors.header from
> application.properties,
> application.properties only contain a single line,like follows
> errors.abc.required=This is a test
>
> When I run ,it will
> show:
>
> the content of 
> null
> This is a test
> null
>
> How to make the show of  is in the same line of
> the
> show of  and only show  name="abc"/>
> without errors.header and errors.footer?
>
> Thanks in advance
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: question

2006-02-23 Thread red phoenix
Thanks Niall, works well. But I find
another question,first look at my application.properties file:
errors.footer= 
errors.header= 
errors.abc.required=This is a test

In my jsp,use follows statement


If errors is not empty,it will should the error message "This is a test"
My question is when I run it,it can show the error message "This is a
test",but the message is not showing in the line with the same line of
,I guess the reason is  shows not
only errors.abc,but shows errors.header and errors.footer,so the  and  will not show in the same
line,if I delete errors.footer and errors.header from application.properties,
application.properties only contain a single line,like follows
 errors.abc.required=This is a test

When I run ,it will
show:

the content of 
null
This is a test
null

How to make the show of  is in the same line of the
show of  and only show 
without errors.header and errors.footer?

Thanks in advance




On 2/24/06, Niall Pemberton <[EMAIL PROTECTED]> wrote:
>
> You should be using the "property" attribute (as you had in your first
> post)
> to do what you want...
>
>
> http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section5
>
> ...not the "name" attribute - that does a different job...
>
>
> http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section4
>
> In your first post you indicated that you were using the old (pre 1.0)
> struts-form.tld.
>
>   <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="html" %>
>
> ... change that to use the html taglib tld:
>
>   <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> then there shouldn't be any problem with the "property" attribute. If
> you're
> using a pre 1.0 version of struts I highly recommend you upgrade.
>
> Niall
>
> - Original Message -
> From: "red phoenix" <[EMAIL PROTECTED]>
> Sent: Friday, February 24, 2006 12:46 AM
>
>
> I changed following code
> if ((abc != null) && (abc.length() > 10))
>
>
> but when the  content of text abc is '123',it's length isn't equals 10,so
> it
> should raise error,but it don't show any error!
> If I use  instead of ,I can get
> right
> value. Why  works well,and  don't
> work. I am puzzled with it.
>
>
> On 2/23/06, Dave Newton <[EMAIL PROTECTED]> wrote:
> >
> > red phoenix wrote:
> > > I modify my code,like follows,this time it don't show any error,but
> when
> > the
> > > content of text abc is '123',it's length isn't equals 10,so it should
> > raise
> > > error,but it don't show any error! Why?
> > >
> > Most likely because in your code you check to see if its length is
> > greater than 10.
> > >> if ((abc != null) && (abc.length() > 0)) {
> > >>
> > I could be wrong.
> >
> > Dave
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: question

2006-02-23 Thread red phoenix
 I changed following code
if ((abc != null) && (abc.length() > 10))


but when the  content of text abc is '123',it's length isn't equals 10,so it
should raise error,but it don't show any error!
If I use  instead of ,I can get right
value. Why  works well,and  don't
work. I am puzzled with it.


On 2/23/06, Dave Newton <[EMAIL PROTECTED]> wrote:
>
> red phoenix wrote:
> > I modify my code,like follows,this time it don't show any error,but when
> the
> > content of text abc is '123',it's length isn't equals 10,so it should
> raise
> > error,but it don't show any error! Why?
> >
> Most likely because in your code you check to see if its length is
> greater than 10.
> >> if ((abc != null) && (abc.length() > 0)) {
> >>
> I could be wrong.
>
> Dave
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: question

2006-02-23 Thread red phoenix
I modify my code,like follows,this time it don't show any error,but when the
content of text abc is '123',it's length isn't equals 10,so it should raise
error,but it don't show any error! Why?

<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="html" %>










On 2/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Which version of Struts are you using?
>
> From Struts 1.0:
> DEPRECATIONS - The entire custom tag library that is documented in
> struts-form.tld has been deprecated because this library has been
> renamed struts-html.tld instead; for ref:
> http://struts.apache.org/struts-action/userGuide/release-notes-1.0-b3.ht
> ml
>
> If you still want to use struts-form.tld then there is no "property"
> attribute as far as I remember; It should be "name" instead "property"
>
> Hope this will help
>
> Chandra
>
> -Original Message-
> From: red phoenix [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 23, 2006 12:48 PM
> To: Struts Users Mailing List
> Subject:  question
>
> I have a JSP file,and I use  in this page,but it raise
> error,my code is follows:
>
> <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="html" %>  
>  
>property="abc" /> 
>
> and my Form is follows:
> ..
> public ActionErrors validate(ActionMapping mapping,HttpServletRequest
> request) {
> ActionErrors errors = new ActionErrors(); if(abc!=null &&
> abc.length()>0){
>   errors.add("abc",new ActionError("error.abc.required"));
> }
> return errors;
> }
>
> When I run it,it raise following error:
> org.apache.jasper.JasperException: /index.jsp(8,15) Attribute property
> invalid for tag errors according to TLD
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(
> JspServletWrapper.java:510)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va
> :375)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.struts.action.ActionServlet.processValidate(ActionServlet.jav
> a
> :2149)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1565)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> I have looked up  API,I find it have property attribute:
> property Name of the property for which error messages should be
> displayed. If not specified, all error messages (regardless of property)
> are displayed. (RT EXPR)
>
> Why raise above error? How to do with it?
>
> Thanks in advance!
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


question

2006-02-22 Thread red phoenix
I have a JSP file,and I use  in this page,but it raise error,my
code is follows:

<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="html" %>









and my Form is follows:
..
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
if(abc!=null && abc.length()>0){
   errors.add("abc",new ActionError("error.abc.required"));
 }
 return errors;
}

When I run it,it raise following error:
org.apache.jasper.JasperException: /index.jsp(8,15) Attribute property
invalid for tag errors according to TLD
org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java
:2149)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1565)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I have looked up  API,I find it have property attribute:
  property Name of the property for which error messages should be
displayed. If not specified, all error messages (regardless of property) are
displayed. (RT EXPR)

Why raise above error? How to do with it?

Thanks in advance!


Re: why my page can't redirect under Struts with Javascript?

2006-02-20 Thread red phoenix
I try follows:
function goURL(tmp){
  document.forms[0].submit();
 }

I debug the Javascript,when running the statement
document.forms[0].submit();

Javascript raise a error:
Microsoft JScript running error:object can't support this attribute or
method

Why?


On 2/21/06, Dave Newton <[EMAIL PROTECTED]> wrote:
>
> red phoenix wrote:
> > I tried follows:
> > function goURL(tmp){
> >   document.forms[0].action=eval("/Log/log.do?action=First");
> >   document.forms[0].submit();
> >  }
> >
> > and
> > function goURL(tmp){
> >   document.forms[0].action=eval("/log.do?action=First");
> >   document.forms[0].submit();
> >  }
> >
> > My page also can't redirect!
> >
> Why are you eval-ing a string? Since "/log.do?action=First" is not a
> valid JavaScript statement, this will fail.
>
> Pay attention to JavaScript errors.
>
> Dave
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: why my page can't redirect under Struts with Javascript?

2006-02-20 Thread red phoenix
I tried follows:
function goURL(tmp){
  document.forms[0].action=eval("/Log/log.do?action=First");
  document.forms[0].submit();
 }

and
function goURL(tmp){
  document.forms[0].action=eval("/log.do?action=First");
  document.forms[0].submit();
 }

My page also can't redirect!

And I try
function goURL(tmp){
  document.forms[0].submit();
 }

I find my page still can't redirect!!!
but I can use following statement to redirect page,


why javascript can't redirect under Struts,and  can redirect in
the same page? It puzzled me for a very long time. It almost mad me mad.




On 2/20/06, Jari Fredriksson <[EMAIL PROTECTED]> wrote:
>
> Swapnil Patil wrote:
> > Hi,
> > I modify my Javascript like follows:
> > function goURL(tmp){
> >  document.forms[0].action=eval("/Log/log.do?action=First");
> >  document.forms[0].submit();
> > }
> >
> > Is eval really needed? . Check whether you really need /Log in
> > contexet path?
> >
> > Try wih following function.
> > function goURL(tmp){
> >  document.forms[0].action="/log.do?action=First";
> >  document.forms[0].submit();
> > }
> >
>
>
> Hmm. Why the "action" has to be inserted to the url in the first place?
>
> Can't the log.do retrieve in as getAction() in the execute? It's the value
> of the combobox and should be readable from the form bean.
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
I have tried
 function goURL(tmp){
var url = "<%=response.encodeURL("/Log/log.do")%>";
document.forms[0].action=url + "?action=" + tmp;
alert(url + "?action=" + tmp);
document.forms[0].submit();
}

Javascript can alert the right information,such as "/Log/log.do?action=3"
But the page still can't redirect!
Why can't redirect?



On 2/20/06, raja sekar <[EMAIL PROTECTED]> wrote:
>
> try this
>
> function goURL(tmp){
> var url = "<%=response.encodeURL("/Log/log.do")%>";
> document.forms[0].action=url + "?action=" + tmp;
> document.forms[0].submit();
> }
>
>
> On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> >
> > when I Javascript execute
> > var url = <%=response.encodeURL("/Log/log.do")%>;
> >
> > IE raise script error:
> > Raise error during running period,debug or not
> > Line:81
> > Error:missing ';'
> >
> >
> > On 2/20/06, raja sekar <[EMAIL PROTECTED]> wrote:
> > >
> > > modify your javascript like this
> > >
> > > function goURL(tmp){
> > > var url = <%=response.encodeURL("/Log/log.do")%>;
> > > document.forms[0].action=url + "?action=" + tmp;
> > > document.forms[0].submit();
> > > }
> > >
> > > and try...
> > >
> > > On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> > > >
> > > > I modify my Javascript like follows:
> > > > function goURL(tmp){
> > > > document.forms[0].action=eval("/Log/log.do?action=First");
> > > > document.forms[0].submit();
> > > > }
> > > >
> > > > But when I change the value of ,it still can't
> redirect.
> > I
> > > am
> > > > mad with it!
> > > >
> > > >
> > > > On 2/20/06, Swapnil Patil <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Hi red,
> > > > >
> > > > > First Page
> > > > > this works with action parameter containing value= "First" NOT
> "0".
> > > > >
> > > > > Your 'tmp' variable in script function contains  value 0,1 or
> > 2.  Your
> > > > > log.do action might be checking content of action parameter with
> > > values
> > > > > "First", "Second" or "Third"
> > > > >
> > > > > Try it again with following manner.
> > > > >
> > > > >  onchange="javascript:goURL(
> > > > > this.options[this.selectedIndex].value)">
> > > > > First
> > > > > Second
> > > > > Third
> > > > > 
> > > > >
> > > > > I hope it will work.
> > > > >
> > > > >
> > > > > On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > I have try follows two method:
> > > > > > function goURL(tmp){
> > > > > > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > > > > > alert(eval("/Log/log.do?action="+tmp));
> > > > > > document.forms[0].submit();
> > > > > > }
> > > > > >
> > > > > > and
> > > > > >
> > > > > > function goURL(tmp){
> > > > > > var newAct = "/Log/log.do?action="+tmp;
> > > > > > document.forms[0].action = newAct;
> > > > > > alert(newAct)
> > > > > > document.forms[0].submit();
> > > > > > }
> > > > > >
> > > > > > I find Javasript can alert right value,such as
> > /Log/log.do?action=3
> > > > > > but I find Javascript don't redirect any page,my action don't be
> > > > called!
> > > > > > Why?
> > > > > >
> > > > > >
> > > > > > On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > A few things here,
> > > > > > >
> > > > > > > 1) I think you need build the action like the following;
> > > > > > >
> > > > > > > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > > > > > >
> > > >

Re: why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
when I Javascript execute
var url = <%=response.encodeURL("/Log/log.do")%>;

IE raise script error:
Raise error during running period,debug or not
Line:81
Error:missing ';'


On 2/20/06, raja sekar <[EMAIL PROTECTED]> wrote:
>
> modify your javascript like this
>
> function goURL(tmp){
> var url = <%=response.encodeURL("/Log/log.do")%>;
> document.forms[0].action=url + "?action=" + tmp;
> document.forms[0].submit();
> }
>
> and try...
>
> On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> >
> > I modify my Javascript like follows:
> > function goURL(tmp){
> > document.forms[0].action=eval("/Log/log.do?action=First");
> > document.forms[0].submit();
> > }
> >
> > But when I change the value of ,it still can't redirect. I
> am
> > mad with it!
> >
> >
> > On 2/20/06, Swapnil Patil <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi red,
> > >
> > > First Page
> > > this works with action parameter containing value= "First" NOT "0".
> > >
> > > Your 'tmp' variable in script function contains  value 0,1 or 2.  Your
> > > log.do action might be checking content of action parameter with
> values
> > > "First", "Second" or "Third"
> > >
> > > Try it again with following manner.
> > >
> > > 
> > > First
> > > Second
> > > Third
> > > 
> > >
> > > I hope it will work.
> > >
> > >
> > > On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> > > >
> > > > I have try follows two method:
> > > > function goURL(tmp){
> > > > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > > > alert(eval("/Log/log.do?action="+tmp));
> > > > document.forms[0].submit();
> > > > }
> > > >
> > > > and
> > > >
> > > > function goURL(tmp){
> > > > var newAct = "/Log/log.do?action="+tmp;
> > > > document.forms[0].action = newAct;
> > > > alert(newAct)
> > > > document.forms[0].submit();
> > > > }
> > > >
> > > > I find Javasript can alert right value,such as /Log/log.do?action=3
> > > > but I find Javascript don't redirect any page,my action don't be
> > called!
> > > > Why?
> > > >
> > > >
> > > > On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > A few things here,
> > > > >
> > > > > 1) I think you need build the action like the following;
> > > > >
> > > > > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > > > >
> > > > > or do it in two steps:
> > > > >
> > > > > var newAct = "/Log/log.do?action="+tmp;
> > > > > document.forms[0].action = newAct;
> > > > >
> > > > > 2) how are you checking the action parameter in your Action class,
> > > > > checking
> > > > > action=First or action=0?
> > > > > the above will give you action=0, or action=1 etc, but not
> > > action=First,
> > > > > action=Second. The reason I ask the question is b/c you mentioned
> > > > >  > > > > page="/log.do?action=First">First Page works for you,
> > you
> > > > are
> > > > > passing a "First" to the action in this case.
> > > > >
> > > > >
> > > > > Saul
> > > > >
> > > > > - Original Message -
> > > > > From: "red phoenix" <[EMAIL PROTECTED]>
> > > > > To: "Struts Users Mailing List" 
> > > > > Sent: Sunday, February 19, 2006 10:12 PM
> > > > > Subject: Re: why my page can't redirect under Struts with
> > Javascript?
> > > > >
> > > > >
> > > > > My  web context is Log,so I add prefix before,like follows:
> > > > >
> > > > > document.forms[0].action="/Log/log.do?action="+eval(tmp);
> > > > >
> > > > > but when I change the value of ,it still can't
> > redirect,I
> > > > am
> > > > > puzzled it for several days.I don't know why it don't red

Re: why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
I modify my Javascript like follows:
function goURL(tmp){
 document.forms[0].action=eval("/Log/log.do?action=First");
 document.forms[0].submit();
}

But when I change the value of ,it still can't redirect. I am
mad with it!


On 2/20/06, Swapnil Patil <[EMAIL PROTECTED]> wrote:
>
> Hi red,
>
> First Page
> this works with action parameter containing value= "First" NOT "0".
>
> Your 'tmp' variable in script function contains  value 0,1 or 2.  Your
> log.do action might be checking content of action parameter with values
> "First", "Second" or "Third"
>
> Try it again with following manner.
>
> 
> First
> Second
> Third
> 
>
> I hope it will work.
>
>
> On 2/20/06, red phoenix <[EMAIL PROTECTED]> wrote:
> >
> > I have try follows two method:
> > function goURL(tmp){
> > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > alert(eval("/Log/log.do?action="+tmp));
> > document.forms[0].submit();
> > }
> >
> > and
> >
> > function goURL(tmp){
> > var newAct = "/Log/log.do?action="+tmp;
> > document.forms[0].action = newAct;
> > alert(newAct)
> > document.forms[0].submit();
> > }
> >
> > I find Javasript can alert right value,such as /Log/log.do?action=3
> > but I find Javascript don't redirect any page,my action don't be called!
> > Why?
> >
> >
> > On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
> > >
> > > A few things here,
> > >
> > > 1) I think you need build the action like the following;
> > >
> > > document.forms[0].action=eval("/Log/log.do?action="+tmp);
> > >
> > > or do it in two steps:
> > >
> > > var newAct = "/Log/log.do?action="+tmp;
> > > document.forms[0].action = newAct;
> > >
> > > 2) how are you checking the action parameter in your Action class,
> > > checking
> > > action=First or action=0?
> > > the above will give you action=0, or action=1 etc, but not
> action=First,
> > > action=Second. The reason I ask the question is b/c you mentioned
> > >  > > page="/log.do?action=First">First Page works for you, you
> > are
> > > passing a "First" to the action in this case.
> > >
> > >
> > > Saul
> > >
> > > - Original Message -
> > > From: "red phoenix" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" 
> > > Sent: Sunday, February 19, 2006 10:12 PM
> > > Subject: Re: why my page can't redirect under Struts with Javascript?
> > >
> > >
> > > My  web context is Log,so I add prefix before,like follows:
> > >
> > > document.forms[0].action="/Log/log.do?action="+eval(tmp);
> > >
> > > but when I change the value of ,it still can't redirect,I
> > am
> > > puzzled it for several days.I don't know why it don't redirect!!!
> > >
> > > I want to use above code to make a pagination program,the
> 
> > > shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when
> > selected
> > > one of items of ,it will call Javascript and redirect
> page
> > to
> > > a
> > > action.
> > >
> > > Anybody can give me some adivce?
> > >
> > >
> > >
> > > On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
> > > >
> > > > For the following:
> > > >
> > > > document.forms[0].action="/log.do?action="+eval(tmp);
> > > >
> > > > You'll need to prefix "/log.do" with your web context. Or you can
> use:
> > > >  in place of /log.do above.
> > > >
> > > > hope it helps.
> > > > Saul
> > > >
> > > >
> > > > - Original Message -
> > > > From: "red phoenix" <[EMAIL PROTECTED]>
> > > > To: 
> > > > Sent: Sunday, February 19, 2006 6:48 PM
> > > > Subject: why my page can't redirect under Struts with Javascript?
> > > >
> > > >
> > > > I use Javascript in Struts,like follows:
> > > >
> > > > 
> > > > function goURL(tmp){
> > > > alert(tmp);
> > > > document.forms[0].action="/log.do?action="+eval(tmp);
> > > > document.forms[0].submit();
> > > > }
> > > > 
> > > >
> > > > 
> > > > First Page
> > > > 
> > > > First
> > > > Second
> > > > Third
> > > > 
> > > > 
> > > >
> > > > when click "First Page",I can redirect my page to log.do page,but
> when
> > I
> > > > change the value of select,and call goURL,I find my page don't
> > redirect
> > > to
> > > > the log.do page,why? I am puzzled with it! Anybody can tell me how
> to
> > > > redirect my page with Javascript under Struts?
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
>
> --
> Thanks & Regards
> Swapnil Patil.
>
>


Re: why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
I have try follows two method:
function goURL(tmp){
 document.forms[0].action=eval("/Log/log.do?action="+tmp);
 alert(eval("/Log/log.do?action="+tmp));
 document.forms[0].submit();
 }

and

 function goURL(tmp){
 var newAct = "/Log/log.do?action="+tmp;
 document.forms[0].action = newAct;
 alert(newAct)
 document.forms[0].submit();
 }

I find Javasript can alert right value,such as /Log/log.do?action=3
but I find Javascript don't redirect any page,my action don't be called!
Why?


On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
>
> A few things here,
>
> 1) I think you need build the action like the following;
>
> document.forms[0].action=eval("/Log/log.do?action="+tmp);
>
> or do it in two steps:
>
> var newAct = "/Log/log.do?action="+tmp;
> document.forms[0].action = newAct;
>
> 2) how are you checking the action parameter in your Action class,
> checking
> action=First or action=0?
> the above will give you action=0, or action=1 etc, but not action=First,
> action=Second. The reason I ask the question is b/c you mentioned
>  page="/log.do?action=First">First Page works for you, you are
> passing a "First" to the action in this case.
>
>
> Saul
>
> - Original Message -
> From: "red phoenix" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" 
> Sent: Sunday, February 19, 2006 10:12 PM
> Subject: Re: why my page can't redirect under Struts with Javascript?
>
>
> My  web context is Log,so I add prefix before,like follows:
>
> document.forms[0].action="/Log/log.do?action="+eval(tmp);
>
> but when I change the value of ,it still can't redirect,I am
> puzzled it for several days.I don't know why it don't redirect!!!
>
> I want to use above code to make a pagination program,the 
> shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected
> one of items of ,it will call Javascript and redirect page to
> a
> action.
>
> Anybody can give me some adivce?
>
>
>
> On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
> >
> > For the following:
> >
> > document.forms[0].action="/log.do?action="+eval(tmp);
> >
> > You'll need to prefix "/log.do" with your web context. Or you can use:
> >  in place of /log.do above.
> >
> > hope it helps.
> > Saul
> >
> >
> > - Original Message -
> > From: "red phoenix" <[EMAIL PROTECTED]>
> > To: 
> > Sent: Sunday, February 19, 2006 6:48 PM
> > Subject: why my page can't redirect under Struts with Javascript?
> >
> >
> > I use Javascript in Struts,like follows:
> >
> > 
> > function goURL(tmp){
> > alert(tmp);
> > document.forms[0].action="/log.do?action="+eval(tmp);
> > document.forms[0].submit();
> > }
> > 
> >
> > 
> > First Page
> > 
> > First
> > Second
> > Third
> > 
> > 
> >
> > when click "First Page",I can redirect my page to log.do page,but when I
> > change the value of select,and call goURL,I find my page don't redirect
> to
> > the log.do page,why? I am puzzled with it! Anybody can tell me how to
> > redirect my page with Javascript under Struts?
> >
> > Thanks
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
My  web context is Log,so I add prefix before,like follows:

document.forms[0].action="/Log/log.do?action="+eval(tmp);

but when I change the value of ,it still can't redirect,I am
puzzled it for several days.I don't know why it don't redirect!!!

I want to use above code to make a pagination program,the 
shows all pages,such as 1st Page,2nd Page,3rd Page and so on,when selected
one of items of ,it will call Javascript and redirect page to a
action.

Anybody can give me some adivce?



On 2/20/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
>
> For the following:
>
> document.forms[0].action="/log.do?action="+eval(tmp);
>
> You'll need to prefix "/log.do" with your web context. Or you can use:
>  in place of /log.do above.
>
> hope it helps.
> Saul
>
>
> - Original Message -
> From: "red phoenix" <[EMAIL PROTECTED]>
> To: 
> Sent: Sunday, February 19, 2006 6:48 PM
> Subject: why my page can't redirect under Struts with Javascript?
>
>
> I use Javascript in Struts,like follows:
>
> 
> function goURL(tmp){
> alert(tmp);
> document.forms[0].action="/log.do?action="+eval(tmp);
> document.forms[0].submit();
> }
> 
>
> 
> First Page
> 
> First
> Second
> Third
> 
> 
>
> when click "First Page",I can redirect my page to log.do page,but when I
> change the value of select,and call goURL,I find my page don't redirect to
> the log.do page,why? I am puzzled with it! Anybody can tell me how to
> redirect my page with Javascript under Struts?
>
> Thanks
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


why my page can't redirect under Struts with Javascript?

2006-02-19 Thread red phoenix
I use Javascript in Struts,like follows:


function goURL(tmp){
alert(tmp);
document.forms[0].action="/log.do?action="+eval(tmp);
document.forms[0].submit();
}



First Page

First
Second
Third



when click "First Page",I can redirect my page to log.do page,but when I
change the value of select,and call goURL,I find my page don't redirect to
the log.do page,why? I am puzzled with it! Anybody can tell me how to
redirect my page with Javascript under Struts?

Thanks