I have a text box in which I would like to be able to write or not depending on the profile that the application uses. This text box is in html code inside a .jsp and I check this profile in its action. How could I do so that if the profile is the desired one, I can write in that text box and if it is not, then not?
<tr>
<td>
<bean:message key="depen.insert.alas"/>
</td>
<td>
<html:text readonly="false" property="alas">
</html:text>
</td>
</tr>
And in the action I have to check a profile:
String p = P.getP(request);
if it's a, the property will be readonly if it's b it won't, but I don't know how to link these things to do this, I know it won't be very difficult but it's the first time I've done it.
Is your text box a
input
or atestarea
? In any case you have the propertydisabled
that specifies whether it is enabled or not.In jsp I think you have the property
disabled
and the propertyreadonly
that accepts a balled value.You can make a condition that checks the type of profile and enable it or not depending on your needs. I have never worked with jsp, but I think something like this would work for you.
As I imagined, it was simple, only because I had no experience and had not touched this, these things never happen. In the same jsp I import the library where I have the method with which I capture the profile:
this is the way to write java code in jsp and import libraries, we will continue to see it (I mean <% %>[didn't know]).
Now I write the change that my code has undergone by knowing how to write java in jsp and knowing how to capture the profile to make the condition:
I hope it can help someone lost like me in the future.