?
Solved

Playing "Data" with get and set property

Posted on 2003-03-09
8
Medium Priority
?
149 Views
Last Modified: 2010-04-01
See this,

JSP pages
=========
<! String test="":
%>
...
...
<jsp:getProperty name="a" property="name" />



Actually i want the return value of this property (name) to be set as a test (variable in my jsp pages).

how can i do that?
0
Comment
Question by:poweranger77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:poweranger77
ID: 8101463
For example, I can do this,

<jsp:setProperty name="upt" property="billcode" param="<jsp:getProperty name="debit1" property="billcode" />" />

But yet, it's thrown mw error... Bur is this a correct one?
or this should be the one,

<jsp:setProperty name="upt" property="billcode" value="<jsp:getProperty name="debit1" property="billcode" />" />
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8103088
>> Actually i want the return value of this property (name) to be set as a test (variable in my jsp pages).
you need this:
<jsp:getProperty name="a" property="name" value='<%=test%>' />

>> <jsp:setProperty name="upt" property="billcode" param="<jsp:getProperty name="debit1" property="billcode" />" />
>> <jsp:setProperty name="upt" property="billcode" value="<jsp:getProperty name="debit1" property="billcode" />" />
neither is not correct, you cannot use a tag as another tag's attribute value.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8103151
you need this:
<jsp:setProperty name="upt" property="billcode" value="<%=debit1.getBillcode()%>" />" />
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:poweranger77
ID: 8108029
>>you need this:
<jsp:getProperty name="a" property="name" value='<%=test%>' />

This one seems doesn't work for me.

I want to set a variable that whole the return valur when I getProperty from a bean.

..
..
<! String number="": %>
..
..
Receipt : <jsp:getProperty name="a" property="name" value="<%= number %>" />
..
..
out.println("Number " + number );



I should see
Receipt : ABC12345
Number  : ABC12345
right?

But he thrown me error...

saying
com.sum.jsp.JspException :"getProperty: Invalid atribute, value"

Meaning to say that I can't put in value into getProperty tag right?
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 200 total points
ID: 8108069
sorry, misunderstood the first part of your question:

you can just simply use <% number=a.getName() %>. you cannot assign to a script var by using <jsp:getProperty> tag.
0
 

Author Comment

by:poweranger77
ID: 8108482
TQ...

I think that's the weakness of the JSP syntax. If I am going touse your suggestion, end up my JSP will back to Servlets prevoius problem, all mixed up with HTML tag, javaCode and also JSP tag....

ai......

Anyway, thanks for your time.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8108515
>> end up my JSP will back to Servlets prevoius problem, all mixed up with HTML tag, javaCode and also JSP tag....
struts has a set of bean tags can do what you are looking for.

struts: http://jakarta.apache.org/struts/doc-1.0.2/index.html

its bean taglib: http://jakarta.apache.org/struts/doc-1.0.2/api/org/apache/struts/taglib/bean/package-summary.html#package_description
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8108520
>> all mixed up with HTML tag, javaCode and also JSP tag....

if you hate this, then you should seriously consider MVC design with struts framework.

HTH
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
The Summer 2017 Scholarship Winners have been announced!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question