• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

page import + standardAction

 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have page import directive in my jsp
<%@ page import="com.*"%>
//when i use scriplet i can just say

TestStdActSrv person= new TestStdActSrv();
person.setName("johny");

//but when i use action i have to specif full quolified name com.TestStdActSrv although i have page import="com.*" and my TestStdActSrv class is in com package.

<jsp:useBean id="person" class="com.TestStdActSrv" scope="request">
<jsp:getProperty name="person" property="name" />
</jsp:useBean>

if i just say TestStdActSrv it DOESNT WORK??

em i the only one who things that that is strange? maybe bug? or it is supposed to be that way?
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This tells the jsp:useBean standard Action that the type of the attribute named person, it is looking at, is of a given class
<jsp:useBean id="person" class="com.TestStdActSrv" scope="request">

The key difference is that the class parameter is itself just a String, that is used somewhere in the jsp:useBean class to cast or force the person object to a type. Does this make sense.

The other thing to remember is that the jsp:useBean code does not have access to the import statement from the jsp.

Mat
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tnx Mat,

it thought that class parameter itself, although a String will be evaluated by translation, but that is obviosli not the case. That explans everything tnx again
 
abhinav singhal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ther also a type tage that you can provide to get successfull type casting between the package and the concrete class. Please try it using in the usebean action tage.


Regards,
Abhinav Singhal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic