search

Home  >  Q&A  >  body text

java - 页面过来的请求包含参数a,该参数没传递到dao,如何在dao获取参数a

ps1 不同用户的不同请求中参数a都是不一样的
ps2 不能给方法加参数,因为太复杂,如果加参数至少要加上百个方法,而且容易遗漏。
java项目
先谢过了,提供思路和方向也好

阿神阿神2815 days ago621

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:44:07

    Method 1: Add parameters to the method, but instead of adding general parameters, you can try using JDK1.5 feature variable length parameters;
    Method 2: Use ThreadLocal data structure to store thread input parameters;
    Method 3: Use cache, etc. ;
    I can think of so much for now, I don’t know if there is a more reasonable logical way to handle the business, I hope it can help you~

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:44:07

    Personally, I think you can try caching, such as Redis.

    reply
    0
  • Cancelreply