开发者

Distinguish between '<' and the encoded equivalent using PortletRequest.getParameter()

开发者 https://www.devze.com 2023-03-15 18:57 出处:网络
I\'m writing a JSR 286 portlet for IBM WebSphere Portal 6.1.I have the following code: @ProcessAction(name=\"processForm\")

I'm writing a JSR 286 portlet for IBM WebSphere Portal 6.1. I have the following code:

@ProcessAction(name="processForm")
public void processForm(ActionRequest request, ActionResponse response) 
    throws PortletException, IOException {    

    String formField1 = request.getParameter("formField1"));
    System.err.println("formField1: " + formField1);
}

If the user submits '<' 开发者_运维问答on the HTML form, the system outputs:

formField1: '&lt;'

However, if the user submits '&lt;' on the HTML form, the system also outputs:

formField1: '&lt;'

This makes it impossible to determine which value the user actually typed into the HTML form. Is there a way around this?

I found an article here which recommends doing a straight replace, but it doesn't address the issue of distinguishing between the two different values on the form.


Can you see that '<' is arriving at the server, and it's not some other component that is altering the '<', such as the browser itself?

If not, how about item 4 on this page (Problem: The "<" and ">" characters display incorrectly):

http://publib.boulder.ibm.com/infocenter/wpdoc/v510/index.jsp?topic=/com.ibm.wp.ent.doc/wps/tbl_sec.html

0

精彩评论

暂无评论...
验证码 换一张
取 消