Problem with jsp:getproperty

M

Meendar

I am having an textbox inside a form , form is used for entry and
edit .
I have used an useBean to display the values while edit.
while i go for edit i have to write java code as

if(bean1.getMethod()!=null)
{
<jsp:getproperty name="bean1" property="method" />
}

Is there any possiblity to avoid code inside the jsp.

Thanks in Advance!
 
L

Lew

Meendar said:
I am having an textbox inside a form , form is used for entry and
edit .
I have used an useBean to display the values while edit.
while i go for edit i have to write java code as

if(bean1.getMethod()!=null)
{
<jsp:getproperty name="bean1" property="method" />
}

Is there any possiblity to avoid code inside the jsp.

If you're using modern JEE with JSTL and EL:

<c:if test="${! empty bean1.method}" >
<jsp:getproperty name="bean1" property="method" />
</c:if>

or better yet, using whatever larger expression you're failing to show us:

<input type="text" id="method" name="method" value="${bean1.method}" />

without any conditional. In unified EL with JSF, it'd be better to use:

<h:inputText id="method" value="#{bean1.method}" />

without any conditional.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top